~DG Download Graphics

Images, graphics and stored formats ZPL tilde command

Downloads a graphic, written as an ASCII hexadecimal string, into printer memory under a name, for later recall.

Format ~DGd:o.x,t,w,data

~DG parameters

Parameters of ~DG
ParameterMeaningAccepted valuesDefault
ddevice to store the imagepp. 175, 176

Where in the printer the image is stored.

The guide's example stores to R: and describes that as loading into DRAM; the entry does not define the other letters.
  • R:Storage location R:.
  • E:Storage location E:.
  • B:Storage location B:.
  • A:Storage location A:.
R:
oimage namepp. 175, 176

The name the image is stored under.

The guide advises against spaces and periods in graphic names and says to use a different name for each graphic.

1 to 8 alphanumeric characters.

UNKNOWN

If no name is given, UNKNOWN is used.

xextensionp. 175

The file extension.

If the extension is not .GRF, .GRF is appended automatically.

.GRF

Not stated in the guide.

ttotal number of bytes in the graphicp. 175

How many bytes the whole image contains.

Guide's worked case: 8 mm wide, 16 mm high, 8 dots/mm gives 8 bytes per row and 128 rows, so t is 1024.

Computed: bytes per row times the number of rows. The guide's formula is (x times z divided by 8) times (y times z), with x the width in mm, y the height in mm and z the dots per mm. Partial bytes are rounded up to a whole byte.

Not stated in the guide.

wnumber of bytes per rowpp. 175, 176

How many bytes make up one row of the image.

Guide's worked case: 8 mm wide at 8 dots/mm gives w of 8. The guide notes that w is the first factor in the t calculation.

Computed: x times z divided by 8, rounded up to a whole byte, with x the width in mm and z the dots per mm.

Not stated in the guide.

dataASCII hexadecimal string defining imagepp. 175, 176

The image, as one continuous string of hexadecimal characters.

In the guide's illustration, four white dots followed by four black dots is the binary code 00001111, written as hex 0F.

A string of hexadecimal characters; each character stands for a horizontal nibble of four dots.

Not stated in the guide.

~DG notes and gotchas

  • Gotcha

    Sending two graphics with the same name replaces the first with the second.

    p. 176
  • Interaction

    The printer decodes and prints the number of bytes given in t and then returns to normal mode. ~DN aborts the graphics mode; the guide says that to clear a ~DG you must send ~DN.

    p. 177
  • Note

    The entry describes the data only as ASCII hexadecimal. In the guide's example the ~DG line comes first and the format that recalls the image (^XA ... ^XZ) follows it.

    pp. 175, 176
  • Note

    The ~DY entry says ~DY can be used in place of ~DG for more saving and loading options, and the ~DG entry points to ~DY for the same reason.

    pp. 175, 181
  • Guide issue

    The ~DG entry describes only plain hexadecimal data. A separate section (Advanced Techniques) describes an alternative compression scheme for ~DG and ~DB data: letters from G upward mean a repeat count of 1 to 19 for the next hex digit, lower-case g to z mean repeat counts in steps of 20 up to 400, a comma fills the rest of the line with zeros, an exclamation mark fills it with ones, and a colon repeats the previous line. The table of letters is cut off at the right edge of page 1761. Page 1762 adds that trailing zeros in the hex string can be replaced by a single comma: for an even number of trailing zeros one comma replaces all of them, for an odd number one zero plus the comma is needed. The ~DG entry itself does not mention any of this.

    pp. 175, 176, 1761, 1762
  • Guide issue

    This entry's formulas use dots per millimeter (z). The dots-per-inch wording elsewhere in the guide is inconsistent (page 49 says 8/mm is 200 dpi, page 210 says 203, page 294 uses 203.2), so density is stated per millimeter here.

    pp. 49, 175, 210, 294

~DG example

example.zplZPL
~DGR:BOX8.GRF,8,1,FF818181818181FF
^XA
^FO30,30^XGR:BOX8.GRF,1,1^FS
^XZ

Stores an 8 by 8 dot image named BOX8.GRF in R:. It has 1 byte per row and 8 rows, so w is 1 and t is 8 (a 1 mm by 1 mm image at 8 dots/mm gives the same numbers). The data has 16 hex digits, two for each row; per the guide's description 1 bits are black dots, so the first and last rows are fully set and each of the six rows between has one set bit at each end. The format then recalls it with ^XG.

Guides that use ~DG

BarcoderX is a .NET SDK for thermal labels and barcodes. See how it prints and exports labels.

Source Zebra, ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide, P1134473-11EN Rev A, 2026/07/05, pages 49, 175 to 177, 181, 201, 204, 210, 215, 248, 294, 373, 1761, 1762.

Written by BarcoderX in its own words. Checked against the guide on 2026-11-14.

ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.