import_image
Import an external PNG onto the canvas, resample to width/height, map to document palette or extend with colors, and write to a layer or store as a named stamp.
Instructions
Import an external PNG supplied as exactly one of png_base64 or path onto the canvas. Resamples to width x height (default native size), maps to the document palette ('document') or extends the palette with median-cut colors ('extend'), then writes it to a layer at (x,y). With as_stamp it is stored as a named stamp instead (place later with paste_stamp). Unlike open_document (new doc) this drops pixels into the current canvas.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Left edge to place at (default 0) | |
| y | No | Top edge to place at (default 0) | |
| clip | No | Silently discard out-of-bounds pixels instead of rejecting (default false) | |
| path | No | Path to a PNG on the server filesystem (mutually exclusive with png_base64) | |
| frame | No | Frame index, 0-based (default: active frame) | |
| layer | No | Layer id or name (default: active layer) | |
| width | No | Resample width (default native) | |
| dither | No | Default none | |
| doc_id | Yes | Document id | |
| height | No | Resample height (default native) | |
| render | No | Include a render of the change (default true) | |
| palette | No | Default document; 'extend' appends extracted colors | |
| as_stamp | No | Store as a named stamp instead of writing to a layer | |
| max_colors | No | extend mode: colors to extract (default 16) | |
| png_base64 | No | PNG file content, base64-encoded (mutually exclusive with path) | |
| skip_transparent | No | Treat transparent source pixels as skip (default true) |