IronFlowDocs

image_convert

Convert between image formats (e.g. PNG to JPEG). Output format is inferred from the output file extension.

Parameters

pathstringone of path or source_key
Input image path (supports ${ctx.key} interpolation)
source_keystringone of path or source_key
Context key containing a source path, artifact URI/descriptor, { artifact = ... }, or explicit Base64 object
output_pathstringrequired
Output image path (format inferred from extension)
qualitynumberdefault 85
JPEG quality (1-100), only used for JPEG output
output_keystringdefault "image_convert"
Prefix for output values

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>_path — output file path
  • <output_key>_format — output format (from extension)
  • <output_key>_successtrue on success

Example

local flow = Flow.new("image_convert_demo")

flow:step("convert", nodes.image_convert({
    path = "examples/fixtures/ironflow-sample.png",
    output_path = "output/photo.jpg",
    quality = 90
}))

flow:step("log", nodes.log({
    message = "Converted to: ${ctx.image_convert_path} (${ctx.image_convert_format})"
})):depends_on("convert")

return flow

Resource contract

Image headers and decoded byte requirements are checked before allocation using IRONFLOW_MAX_IMAGE_ENCODED_BYTES (50 MiB), IRONFLOW_MAX_IMAGE_PIXELS (25 million), and IRONFLOW_MAX_IMAGE_DECODE_ALLOCATION_BYTES (128 MiB). JPEG conversion admits the retained source plus RGB conversion buffer. Decode, format conversion, and encode run on a tracked blocking worker with cancellation checkpoints between opaque codec operations. JPEG output is streamed to its destination instead of first accumulating the complete encoded file in memory.

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

to move · Enter to open · Esc to close