Saltar al contenido principal

Cambiar tamaño de la imagen en n8n

Cambiar tamaño de la imagen es un PDF4me acción del nodo en n8n Esta herramienta ajusta el tamaño de una imagen, ya sea mediante un porcentaje de su tamaño original o a la anchura y altura exactas en píxeles, con la opción de conservar la relación de aspecto. Úsela para generar miniaturas, normalizar las imágenes subidas por los usuarios a un tamaño estándar o reducir el tamaño de las fotos demasiado grandes antes de que se almacenen.

Lo que hace este nodo

PDF4me: Cambiar tamaño de la imagen toma una imagen de Binary Data, un Base64 String, o un URL y devuelve una copia escalada. Tipo de cambio de tamaño El campo decide el método: Porcentaje escala en relación con el original, lo que se adapta a entradas de tamaños mixtos, mientras que Específico Esta función define un ancho y alto exactos en píxeles para espacios de diseño fijos. Dado que el nodo se ejecuta una vez por cada elemento entrante, un nodo configurado redimensiona todo un lote con la misma configuración.

Entradas de blog relacionadas
Aún no hay ninguna entrada de blog sobre esta función; estará disponible próximamente.
Mientras tanto, echa un vistazo al blog de PDF4me para encontrar tutoriales y flujos de trabajo para todas las plataformas.
Visita el blog

Autenticando su API Pedido

Cada PDF4me nodo en n8n requiere un válido Credencial para conectarse con. Crea o selecciona uno que contenga tu PDF4me API clave para que el flujo de trabajo pueda autenticar las solicitudes de redimensionamiento de forma segura.

Datos importantes que no debes perderte

El tipo de redimensionamiento decide qué campos aparecen.
Al seleccionar Porcentaje, se mostrará el Porcentaje de redimensionamiento. Al seleccionar Específico, se mostrarán Ancho y Alto. Nunca se deben completar ambos conjuntos.
Mantener la relación de aspecto evita la distorsión.
Deja esta opción activada a menos que necesites deliberadamente dimensiones no proporcionales. Si la desactivas, una diferencia entre el ancho y la altura distorsionará la imagen.
Ampliar no puede inventar detalles
Un porcentaje superior al 100% aumenta las dimensiones de los píxeles, pero no la nitidez. Utilice siempre la fuente de mayor resolución disponible.
Nodo PDF4me en n8n configurado con Acción Redimensionar Imagen, Tipo de Datos de Entrada Datos Binarios, Campo de Entrada Datos Binarios, Nombre del Archivo de Salida resize_image_output.jpg, Tipo de Redimensionamiento Porcentaje, Porcentaje de Redimensionamiento 50, con las opciones Mantener Relación de Aspecto y Asíncrono habilitadas.

PDF4me Panel de parámetros de redimensionamiento de imagen en n8n, mostrado en modo porcentaje

Porcentaje vs. Tamaño específico: ¿Qué tipo de redimensionamiento debería usar?

Los dos modos resuelven problemas diferentes, y elegir el incorrecto es la causa más común de tamaños de salida inesperados.

Tipo de cambio de tamañoCampos que usted rellenaMejor 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

¿Qué parámetros necesita la función de redimensionar imagen?

Requerido: Acción, tipo de datos de entrada, el campo que coincide con ese tipo de entrada, nombre del archivo de salida, tipo de redimensionamiento y los campos de dimensión que revela el tipo de redimensionamiento. Async y el nombre de salida de datos binarios tienen valores predeterminados de funcionamiento.

ParámetroRequeridoLo que haceEjemplo
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 salida

Una carrera exitosa devuelve uno n8n Artículo que contiene la imagen redimensionada y su informe de dimensiones.

CampoTipoLo que contiene
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.

¿Cómo configuro el redimensionamiento de imágenes en? n8n¿

  1. Agregar PDF4me a tu n8n flujo de trabajo y elegir el Cambiar tamaño de la imagen acción.
  2. En Credencial para conectarse con, seleccione su PDF4me credenciales o haga clic Crear nueva credencial y pega tu API llave.
  3. Colocar Tipo de datos de entrada a Datos binarios (por defecto), Base64 String, o URL y proporcione el campo de imagen de origen correspondiente.
  4. Colocar Tipo de cambio de tamaño a Porcentaje y rellenar Porcentaje de redimensionamientoo para Específico y rellenar Ancho y Altura.
  5. Dejar Mantener la relación de aspecto habilitado para evitar el estiramiento y habilitar Async para imágenes grandes o lotes extensos.
  6. Colocar Nombre del archivo de salida, ejecute el nodo y verifique newDimensions en la salida para confirmar el resultado.

Configuraciones típicas

Ejemplos de flujo de trabajoCommon n8n workflow patterns using Resize Image.
Miniaturas de las cargas de productos
  1. Se ha almacenado una nueva imagen de producto en la nube.
  2. La función Redimensionar imagen se ejecuta en modo específico con las dimensiones de la cuadrícula de miniaturas.
  3. La miniatura aparece junto a la imagen original a tamaño completo.
Reducir el tamaño de las cargas de usuario excesivas
  1. Un webhook recibe una foto enviada a través de un formulario.
  2. La función Redimensionar imagen se ejecuta en modo Porcentaje para reducirla proporcionalmente.
  3. Se almacena un archivo más pequeño, lo que permite controlar el almacenamiento y el ancho de banda.
Normalizar por lotes una biblioteca de imágenes
  1. Un nodo Loop Over Items itera sobre una carpeta existente de imágenes de diferentes tamaños.
  2. Redimensionar imagen aplica una configuración consistente a cada elemento, con Async activado.
  3. La biblioteca termina siendo uniforme sin que nadie abra un editor.
Redimensiona y luego comprime para la web.
  1. Se extrae una imagen editorial de un CMS.
  2. La opción Redimensionar imagen la ajusta primero al ancho de la pantalla.
  3. La función Comprimir imagen reduce aún más el tamaño del archivo antes de publicarlo.

Consejos prácticos

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.

Hoja de trucos

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

Preguntas frecuentes

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.

Acciones relacionadas

La misma tarea en otras plataformas

Obtén ayuda