Image
Prints a JPEG, PNG, WebP, or SVG image after converting it to a printer-compatible raster image.
Provide exactly one source:
datafor raw base64-encoded image bytes without a data-URL prefix;urlfor an HTTPS URL when the server hasALLOW_REMOTE_IMAGE_URLS=true.
Example
{
"type": "image",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=",
"align": "center",
"maxWidth": 50,
"fit": "inside",
"withoutEnlargement": true,
"transforms": [
"floydSteinberg"
]
}Fields
| Field | Type | Description |
|---|---|---|
typerequired | "image" | Discriminator for image blocks. |
dataoptional | string | Base64-encoded JPEG, PNG, WebP, or SVG data. Provide exactly one of data or url.
|
urloptional | string | HTTPS image URL with a public domain hostname. Direct IP addresses, plain HTTP, credentials, localhost-style names, and redirects are not allowed.
|
alignoptional | string | Horizontal alignment of the printed image.
|
maxWidthoptional | integer | Maximum image width as a percentage of the printer paper width. Note: If `withoutEnlargement` is `false`, smaller images are upscaled to the specified width.
|
fitoptional | string | Resize fit mode used when scaling the image to the printer width.
|
withoutEnlargementoptional | boolean | Do not enlarge image if it is already smaller than the printer width.
|
transformsoptional | array<"floydSteinberg"> | Image transforms to apply before printing. Currently only supports Floyd-Steinberg dithering. |
rgbToBlackoptional | integer | Optional black threshold for rasterizing pixels. Lower values print fewer black pixels; higher values print more.
|