IronFlowDocs

image_crop

Crop a single image file.

Parameters

pathstringone of path or source_key
Source image path (supports ${ctx.key} interpolation).
source_keystringone of path or source_key
Context key containing either a path string, or an object entry { path = "..." } / { base64 = "..." }.
output_pathstringrequired
Destination file path for the cropped image.
xnumberdefault 0
Left offset in pixels.
ynumberdefault 0
Top offset in pixels.
crop_widthnumberdefault alias: width
Crop width in pixels.
crop_heightnumberdefault alias: height
Crop height in pixels.
formatstringdefault inferred from output_path or png
Output format: png, jpeg, or jpg.
output_keystringdefault "cropped_image"
Prefix for the generated context output keys.

If both path and source_key are provided, execution fails.

Context Output

  • <output_key> — output file path.
  • <output_key>_width — crop width.
  • <output_key>_height — crop height.
  • <output_key>_x — x offset used.
  • <output_key>_y — y offset used.
  • <output_key>_format — output format ("png" or "jpeg").
  • <output_key>_successtrue on success.

Example

local flow = Flow.new("image_crop_demo")

flow:step("crop", nodes.image_crop({
    path = "examples/fixtures/ironflow-sample.png",
    output_path = "outputs/sample_front_cropped.png",
    x = 10,
    y = 8,
    crop_width = 120,
    crop_height = 80
}))

flow:step("log", nodes.log({
    message = "Cropped image: ${ctx.cropped_image_width}x${ctx.cropped_image_height}"
})):depends_on("crop")

return flow

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

to move · Enter to open · Esc to close