Skip to content

Draw Image

Mikkel102454 edited this page Oct 6, 2026 · 2 revisions

draw_image

Draw a packed, indexed image. The payload is raw palette data encoded as Base64, not a PNG, JPEG, or SVG file.

Argument Type Required Meaning
x, y integer Yes Nonnegative image origin
width, height integer Yes Positive pixel dimensions
data string Yes Base64-encoded packed pixels
transparent integer No Index to skip; default 4; -1 disables skipping

Example

{
  "cmd": "draw_image",
  "args": {
    "x": 20,
    "y": 20,
    "width": 2,
    "height": 2,
    "data": "ASQ=",
    "transparent": 4
  }
}

The decoded bytes are 0x01 0x24: black and white on the first row, yellow and transparent on the second. See Image Encoding for byte packing and odd pixel counts.

The decoded length must equal ceil(width * height / 2) or the image is skipped. Use indices 0–3 for visible pixels. Setting transparent to another palette index skips that color instead; using -1 does not make index 4 a valid visible color.

The current canvas point path places image pixels one pixel above and left of the nominal origin. Keep images within bounds and account for this when aligning to other primitives; see Renderer Notes.

Implementation references

Clone this wiki locally