^GF
Graphic FieldPreview: partialEmbeds a bitmap directly in the label — the command every PDF-to-ZPL and image-to-ZPL conversion produces.
Syntax
^GFa,b,c,d,dataParameters
| Parameter | Description and accepted values | If omitted |
|---|---|---|
| a | Data format. A is ASCII hex; B and C are binary and compressed binary.A ASCII hex, B binary, C compressed binary | A |
| b | Number of bytes in the data that follows.1 to 99999 — bytes in the data field | Value of c |
| c | Total bytes in the graphic.1 to 99999 — total bytes in the graphic | Value of b |
| d | Bytes per row — eight dots of image width per byte.1 to 99999 — bytes per row | Value of c |
| data | The bitmap payload, in the format selected by the first parameter.The bitmap itself, one bit per dot | None |
How it works
^GF carries a monochrome bitmap inside the format itself, one bit per dot. It is what a converter emits when it turns a logo or a rendered page into ZPL, and it is the reason converted labels are large: a 4 × 6 inch label at 300 dpi is roughly 700 KB as uncompressed ASCII hex.
The bytes-per-row parameter sets the image width — eight dots per byte, so a 16-dot-wide image is 2 bytes per row. The total byte count divided by bytes per row gives the height. Getting either wrong shears the image diagonally, which is the classic symptom of a bad ^GF.
Format A is ASCII hex and is the most portable. Formats B and C send binary and compressed binary, and Zebra also accepts Z64, a deflate-compressed base64 payload that cuts the size dramatically and is what you want for anything large going over a slow link.
Example
^XA
^FO40,40^GFA,32,32,2,FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF^FS
^XZRendering…
How the preview on this site handles it
ASCII hex is drawn correctly. The format parameter is not yet read, so binary, compressed binary and Z64 payloads do not preview — the field is drawn as if the data were plain hex.
Common mistakes
- A bytes-per-row value that does not match the image width. The picture comes out sheared.
- Widths that are not a multiple of 8. The row is padded to the next whole byte, so plan the image around it.
- Sending large uncompressed hex over a serial link. Use Z64, or store the image once with ~DG and recall it with ^XG.