Pular para o conteúdo principal

Redimensionar imagem em n8n

Redimensionar imagem é um PDF4me ação do nó em n8n Essa ferramenta redimensiona uma imagem, seja por uma porcentagem do seu tamanho original ou para a largura e altura exatas em pixels, com a opção de preservar a proporção disponível. Use-a para gerar miniaturas, normalizar uploads de usuários para um tamanho adequado ou reduzir fotos muito grandes antes que sejam armazenadas.

O que este nó faz

PDF4me: Redimensionar imagem Extrai uma imagem de dados binários, um Base64 Stringou um URL e retorna uma cópia dimensionada. Tipo de redimensionamento O campo define o método: Percentagem escalas relativas ao original, o que é adequado para entradas de tamanhos mistos, enquanto Específico Define uma largura e altura exatas em pixels para espaços de layout fixos. Como o nó é executado uma vez para cada item recebido, um nó configurado redimensiona um lote inteiro com configurações idênticas.

Artigos relacionados no blogue
Ainda não há nenhuma publicação no blogue sobre esta funcionalidade — em breve.
Entretanto, explore o blogue da PDF4me para encontrar tutoriais e fluxos de trabalho para todas as plataformas.
Visite o blogue

Autenticando seu API Solicitar

Todo PDF4me nó em n8n requer um válido Credencial para se conectar comCrie ou selecione um que contenha o seu PDF4me API chave para que o fluxo de trabalho possa autenticar solicitações de redimensionamento com segurança.

Fatos importantes que você não deve perder

O tipo de redimensionamento define quais campos serão exibidos.
Selecionar "Porcentagem" exibe a porcentagem de redimensionamento. Selecionar "Específico" exibe a largura e a altura. Você nunca deve preencher ambos os campos.
Manter a proporção da tela evita distorções.
Deixe essa opção ativada, a menos que você precise deliberadamente de dimensões não proporcionais. Com ela desativada, uma largura e altura incompatíveis distorcerão a imagem.
Ampliar não cria detalhes
Uma porcentagem acima de 100 aumenta as dimensões dos pixels, mas não a nitidez. Comece sempre com a fonte de maior resolução disponível.
O nó PDF4me no n8n está configurado para Ação Redimensionar Imagem, Tipo de Dados de Entrada Dados Binários, Campo de Entrada dados binários, Nome do Arquivo de Saída resize_image_output.jpg, Tipo de Redimensionamento Porcentagem, Porcentagem de Redimensionamento 50, com as opções Manter Proporção e Assíncrono ativadas.

PDF4me Painel de parâmetros de redimensionamento de imagem em n8n, exibido no modo de porcentagem

Percentagem versus específico: qual tipo de redimensionamento você deve usar?

Os dois modos resolvem problemas diferentes, e escolher o modo errado é a causa mais comum de tamanhos de saída inesperados.

Tipo de redimensionamentoCampos que você preencheMelhor ajuste
PercentageResize Percentage, for example 50 to halve or 200 to doubleMixed-size inputs that should all shrink or grow by the same proportion, keeping their relative differences
SpecificWidth and Height in pixelsA fixed layout slot, thumbnail grid, or platform that demands exact dimensions regardless of the source size

Quais parâmetros a função Redimensionar Imagem precisa?

Obrigatório: Ação, Tipo de Dados de Entrada, o campo correspondente a esse tipo de entrada, Nome do Arquivo de Saída, Tipo de Redimensionamento e os campos de dimensão que o Tipo de Redimensionamento revela. Async e o nome de saída de dados binários mantém os valores padrão de funcionamento.

ParâmetroObrigatórioO que fazExemplo
ActionRequiredSelects the PDF4me node action to run. Choose Resize Image.Resize Image
Input Data TypeRequiredFormat of the source image input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the image. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Image ContentConditionalBase64-encoded content of the source image. Required when Input Data Type is Base64 String./9j/4AAQSkZJRgAB...
Image URLConditionalPublicly reachable HTTPS URL to the source image. Required when Input Data Type is URL.https://example.com/photo.jpg
Output File NameRequiredFilename for the resized image. Include the extension matching the output format.resize_image_output.jpg
Resize TypeRequiredScaling method. Percentage scales relative to the original size, Specific targets exact pixel dimensions. Your choice decides which fields appear next.Percentage
Resize PercentageConditionalScaling percentage relative to the original. Below 100 reduces, above 100 enlarges. Required when Resize Type is Percentage.50
WidthConditionalTarget width in pixels. Required when Resize Type is Specific.800
HeightConditionalTarget height in pixels. Required when Resize Type is Specific.600
Maintain Aspect RatioOptionalToggle that preserves the original proportions so the image is not stretched. Leave enabled unless you need forced dimensions.true
AsyncOptionalToggle that runs the resize in the background instead of holding the workflow execution open. Useful for large images or long batches.true
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data

Campos de saída

Uma corrida bem-sucedida retorna um n8n item contendo a imagem redimensionada e seu relatório de dimensões.

CampoTipoO que contém
Binary (data)BinaryThe resized image, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output image, for example image/jpeg or image/png.
fileSizeNumberSize of the resized image in bytes.
originalDimensionsStringWidth and height of the source image in pixels, for example 1920x1080.
newDimensionsStringWidth and height after resizing, for example 960x540. Compare it against your target to confirm aspect ratio behaviour.
successBooleanTrue when the resize completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

Como faço para configurar o redimensionamento de imagem? n8n?

  1. Adicionar PDF4me para o seu n8n fluxo de trabalho e escolha o Redimensionar imagem Ação.
  2. Em Credencial para se conectar com, selecione o seu PDF4me credencial ou clique Criar nova credencial e cole o seu API chave.
  3. Definir Tipo de dados de entrada para Dados binários (padrão), Base64 String, ou URL e forneça o campo da imagem de origem correspondente.
  4. Definir Tipo de redimensionamento para Percentagem e preencha Porcentagem de redimensionamento, ou para Específico e preencha Largura e Altura.
  5. Deixar Manter a proporção da tela ativado para evitar alongamento e ativar Async Para imagens grandes ou lotes extensos.
  6. Definir Nome do arquivo de saída, execute o nó e verifique newDimensions na saída para confirmar o resultado.

Configurações típicas

Exemplos de fluxo de trabalhoCommon n8n workflow patterns using Resize Image.
Miniaturas de uploads de produtos
  1. Uma nova imagem de produto é disponibilizada no armazenamento em nuvem.
  2. A função Redimensionar Imagem é executada no modo Específico, com as dimensões da grade de miniaturas.
  3. A miniatura é impressa ao lado da imagem original em tamanho real.
Reduzir o tamanho dos uploads de usuários que são muito grandes
  1. Um webhook recebe uma foto enviada através de um formulário.
  2. A função Resize Image (Redimensionar Imagem) é executada no modo Porcentagem para reduzir a imagem proporcionalmente.
  3. O arquivo menor é armazenado, mantendo o armazenamento e a largura de banda sob controle.
Normalizar em lote uma biblioteca de imagens
  1. Um nó "Loop Over Items" itera sobre uma pasta existente contendo imagens de tamanhos variados.
  2. A opção Redimensionar Imagem aplica uma configuração consistente a todos os itens, com Async habilitado.
  3. A biblioteca acaba ficando uniforme sem que ninguém abra um editor.
Redimensione e depois comprima para a web.
  1. Uma imagem editorial é extraída de um CMS (Sistema de Gestão de Conteúdos).
  2. A opção "Redimensionar imagem" primeiro ajusta a imagem à largura da tela.
  3. A compressão de imagem reduz ainda mais o tamanho do arquivo antes da publicação.

Dicas práticas

Resize before you compress, not after
Reducing dimensions first means the compressor has less data to work on, which usually gives a better result than compressing a full-size image.
Leave Maintain Aspect Ratio on by default
Turning it off only makes sense when a target slot genuinely demands non-proportional dimensions. Otherwise it silently stretches faces and logos.
Use Percentage for mixed-size inputs
When sources vary, a fixed pixel target crops or pads inconsistently. A percentage keeps every image in proportion to where it started.
Read newDimensions rather than assuming
The output reports both original and new dimensions, which is the fastest way to confirm aspect ratio handling did what you expected.
Match the Output File Name extension to the format
Naming a PNG output with a .jpg extension confuses downstream nodes and any application that opens the file by extension.
Enable Async for large batches
Long-running batches are exactly where a synchronous call risks timing out, and Async keeps the execution from being held open.

Folha de dicas

CampoValor
ActionResize Image
Input Data TypeBinary Data
Input Binary Fielddata
Output File Nameresize_image_output.jpg
Resize TypePercentage
Resize Percentage50
Width / Height (Specific mode)800 / 600
Maintain Aspect Ratiotrue
Asynctrue
Binary Data Output Namedata

Perguntas frequentes

Should I resize by percentage or by exact pixel dimensions?+
Use Percentage when the source images vary in size and you want them all reduced or enlarged by the same proportion, for example halving every upload. Use Specific when a target slot demands fixed dimensions, such as a thumbnail grid or a platform that requires an exact width and height.
What happens if I turn off Maintain Aspect Ratio?+
With Maintain Aspect Ratio on, the original proportions are preserved so the image is never stretched. Turning it off lets the width and height you supply be applied independently, which will distort the picture if the target aspect ratio differs from the source. Leave it on unless you specifically need to force non-proportional dimensions.
Does enlarging an image with a percentage above 100 improve its quality?+
No. Scaling above 100 percent increases the pixel dimensions but cannot add detail that was never captured, so an enlarged image will look softer than a natively larger original. Enlarge only when a layout demands the dimensions, and prefer starting from the highest-resolution source you have.
When should I enable Async on the Resize Image node?+
Async Processing runs the resize in the background rather than holding the workflow execution open, which helps with large source images or long batch runs where a synchronous call might otherwise time out.
How do I resize many images in one n8n workflow?+
Feed the images in as multiple items, for example from a folder listing or a Loop Over Items node, and place Resize Image after it. The node runs once per item, so a single configured node handles the whole batch with identical settings rather than needing one node per file.

Ações relacionadas

Mesma tarefa em outras plataformas

Obtenha ajuda