Image Aspect Ratio Cropper icon

Image Aspect Ratio Cropper

Crop images to exact aspect ratios using center-cover mode. Supports JPEG, PNG, WebP, GIF, TIFF, SVG formats.

Image Aspect Ratio Cropper

AI-generated

Summary

Crop images to a specified exact aspect ratio using center-cover cropping, optionally changing the output format and quality.

Inputs

  • Binary Property (required) — The name of the binary property containing the input image data (e.g., 'data').
  • Aspect Ratio (required) — The target aspect ratio in W:H format (e.g., '16:9', '1:1', '4:3'). Supports common ratios and expressions (e.g., {{ $json.aspectRatio }}).
  • Output Format (required) — The desired output image format. Options include 'Same as Input', 'JPEG', 'PNG', 'WebP', 'GIF', and 'TIFF'. Default is 'Same as Input'.
  • JPEG Quality — JPEG output quality (1-100), used only if output format is JPEG. Default is 80.
  • WebP Quality — WebP output quality (1-100), used only if output format is WebP. Default is 80.

Output shape

A list of output items each containing JSON metadata and binary image data with the cropped image under the same binary property name as the input.

Each output item includes JSON metadata with original image dimensions, cropped dimensions, crop position, scale factor, aspect ratio, and a message indicating if cropping occurred. The binary data is the cropped image in the selected output format with a filename including the target aspect ratio. Errors for individual items are returned with an error message in JSON if 'Continue On Fail' is enabled.

Discussion