Image & Canvas canvasLoadImage

$canvasLoadImage

Loads an image from a URL, data URL, or base64 string onto the canvas

Syntax
$canvasLoadImage[url;x?;y?;width?;height?;container?]

Parameters

Parameter Type Required Default Description
url string check_circle Required Image source — HTTP/HTTPS URL, data:image/...;base64 URL, or raw base64 string. HTTP requests have a 15-second timeout.
x integer Optional Horizontal position on canvas
y integer Optional Vertical position on canvas
width integer Optional Resize width. If specified with height, the image is resized before placement.
height integer Optional Resize height. Must be paired with width.
container string Optional Name of a registered container for relative positioning

Return Value

canvas

If no canvas exists yet, the loaded image becomes the new canvas. If a canvas already exists AND x/y/width/height are specified, the image is composited on top. URL-loaded images are cached in a 50 MB LRU cache for the duration of the block.

$canvasLoadImage is dual-purpose: when no canvas exists, it creates one from the loaded image. When a canvas already exists, it composites the image on top. HTTP images are cached in a 50 MB LRU cache that persists for the lifetime of the current deferred block. If the URL fails to load within 15 seconds, the operation silently fails and the canvas remains unchanged.

Examples

Load image as canvas

$canvasLoadImage[https://example.com/background.jpg]
$canvasDrawText[Overlay text;50;50;20;white]
$attachImage[output]

Load and resize onto existing canvas

$canvasCreate[composite;800;600;#2C2F33]
$canvasLoadImage[https://example.com/logo.png;50;50;200;200]
$attachImage[composite]