^GF Graphic Field

Embeds a binary or compressed bitmap image directly into the label format.

Supported in ZPL Preview

^GF renders a graphic (bitmap image) on the label by embedding the image data directly in the ZPL stream. This is how you print logos, icons, signatures, and other raster graphics on thermal labels without downloading an image file to the printer in advance.

The format parameter (a) selects the image data encoding: A = binary (1 bit per pixel, uncompressed), B = binary (Z compressed), C = binary (Z compressed, field-by-field). For sending raw ZPL from a backend, use A (ASCII hex) for compatibility. The Zebra-proprietary GRF format (used by ~DY and ^XG) is more efficient for repeated use of the same image.

The data count (b) is the total number of bytes of image data. The bytes per row (c) is the number of bytes needed for one horizontal line of the image (image width in pixels ÷ 8, rounded up). The graphic field width (d) matches bytes per row; it's used for display width. The data (data) is the actual image encoded as the format selected.

For logos and repeated graphics, the better practice is to download the image once to printer memory using ~DY (Download Graphics) and then reference it in labels using ^XG (Recall Graphic). ^GF embeds the full image data on every label print, which increases data transfer volume significantly.

When converting images for ^GF: convert to 1-bit black and white, width must be a multiple of 8 bits (one byte per 8 pixels across), and invert if necessary (ZPL's bit convention is 1 = black).

Syntax

^GFa,b,c,d,data

Parameters

ParameterTypeDefaultDescription
aA | B | CACompression: A = ASCII hex (uncompressed), B = binary compressed, C = compressed field-by-field.
bintegeroptionalTotal byte count of the image data.
cintegeroptionalBytes per row (image width ÷ 8, rounded up to nearest integer).
dintegeroptionalGraphic field width in bytes — usually the same as c.
datahex stringoptionalThe image data: ASCII hex pairs (e.g., "FF00FF...") for format A, or binary bytes for formats B/C.

Examples

Small 8×8 checkerboard pattern

Try in Viewer
^XA
^FO50,50^GFA,8,8,8,AA55AA55AA55AA55^FS
^FO150,60^A0N,28,28^FDCheckerboard^FS
^XZ

16-pixel wide horizontal stripes

Try in Viewer
^XA
^FO50,50^GFA,16,16,2,FFFF00000000FFFF00000000FFFF0000^FS
^XZ

Common Mistakes

  • !Getting b (total bytes) and c (bytes per row) wrong — the image renders as a scrambled mess if these don't match the actual data.
  • !Using RGB or grayscale image data — ^GF requires 1-bit (monochrome) data; convert first.
  • !Embedding large images with ^GF on every label — use ~DY to download once and ^XG to reference for high-volume jobs.
  • !Not aligning image width to a byte boundary — image width must be a multiple of 8 pixels.
^GF Graphic Field — ZPL Command Reference | Prynta Co | Prynta Co