Skip to content

Draw Image

Mikkel edited this page May 6, 2026 · 2 revisions

draw_image

Draws a packed indexed image.


Image Format

Images use indexed pixel data encoded as Base64.

Pixel format:

  • 4 bits per pixel
  • 2 pixels packed per byte
  • Indexed palette rendering

See:


Arguments

Name Type Description
x int Top-left X coordinate
y int Top-left Y coordinate
width int Image width
height int Image height
data string Base64 encoded pixel data

Notes

  • Transparent pixels are skipped during rendering
  • Images are rendered sequentially like other commands
  • Existing pixels may be overwritten
  • Rendering outside display bounds may be clipped

Example

{
  "cmd": "draw_image",
  "args": {
    "x": 100,
    "y": 0,
    "width": 100,
    "height": 100,
    "data": "BASE64_DATA"
  }
}

Renderer Recommendations

Renderers should:

  • Decode Base64 image payloads safely
  • Validate image dimensions
  • Ignore invalid pixel values where possible
  • Skip transparent pixels
  • Avoid drawing outside framebuffer bounds

Related Pages

Clone this wiki locally