image_resize
Resize a single image file.
Parameters
- pathstringone of
pathorsource_key - Source image path (supports
${ctx.key}interpolation). - source_keystringone of
pathorsource_key - Context key containing a path, artifact URI/descriptor,
{ artifact = ... }, or an explicit{ base64 = "..." }object. - output_pathstringrequired
- Destination file path for the resized image.
- widthnumber
- Target width in px. Required if
heightis omitted. - heightnumber
- Target height in px. Required if
widthis omitted. - formatstringdefault inferred from output_path or png
- Output format:
png,jpeg, orjpg. - output_keystringdefault "resized_image"
- Prefix for the generated context output keys.
If both
pathandsource_keyare provided, execution fails. Artifact inputs are opened and SHA-256 verified inside the tracked blocking worker; decoding consumes that same rewound handle rather than a resolved store pathname.
Supported source formats are BMP, Farbfeld, GIF, HDR, ICO, JPEG, PNG, PNM, QOI, TGA, TIFF, and WebP. Output remains restricted to PNG or JPEG.
Context Output
<output_key>— output file path.<output_key>_width— output width in pixels.<output_key>_height— output height in pixels.<output_key>_format— output format ("png"or"jpeg").<output_key>_success—trueon success.
Example
local flow = Flow.new("image_resize_demo")
flow:step("resize", nodes.image_resize({
path = "examples/fixtures/ironflow-sample.png",
output_path = "outputs/sample_front_small.png",
width = 120
}))
flow:step("log", nodes.log({
message = "Resized to ${ctx.resized_image_width}x${ctx.resized_image_height}"
})):depends_on("resize")
return flow
Resource contract
The encoded source, decoded dimensions/pixels, decoder allocation, and computed
output dimensions are checked against IRONFLOW_MAX_IMAGE_ENCODED_BYTES (50
MiB), IRONFLOW_MAX_IMAGE_PIXELS (25 million), and
IRONFLOW_MAX_IMAGE_DECODE_ALLOCATION_BYTES (128 MiB) before resize allocation;
the allocation check includes the retained source and computed output buffer.
Decode, resize, and encode run on a tracked blocking worker; cancellation is
observed between opaque codec and transform operations.