Guide · Under the hood

How ESC/POS raster image printing works

The exact bytes a receipt printer receives when you click Print image.

Last updated: October 2026

ESC/POS is the command language Epson created for receipt printers; it is now supported, at least in a basic form, by almost every thermal printer on the market. Commands are short byte sequences that usually start with ESC (0x1B) or GS (0x1D). Anything that is not a command is printed as text. This guide walks through the commands Elysano sends to print one image.

1. Initialise: ESC @

1B 40

Resets the printer to its default state — clears any leftover formatting from a previous job. Every job should start with it.

2. Centre alignment: ESC a 1

1B 61 01

Images narrower than the print head are centred instead of hugging the left edge.

3. The image: GS v 0

The raster bit-image command is GS v 0 m xL xH yL yH d1…dk:

BytesMeaning
1D 76 30GS v 0 — print raster bit image
mMode: 0 = normal, 1 = double width, 2 = double height, 3 = both
xL xHWidth in bytes (not dots), little-endian: xL + xH × 256
yL yHHeight in dots (rows), little-endian
d1…dkThe bitmap: width-bytes × height bytes, row by row

Each data byte holds 8 horizontal dots; the most significant bit is the leftmost dot, and a 1 means black. A 576-dot line is therefore 72 bytes.

Worked example

An 80 mm image of 576 × 200 dots, normal mode:

1D 76 30 00  48 00  C8 00  [14 400 bytes of bitmap]

0x48 = 72 bytes per row, 0xC8 = 200 rows, and 72 × 200 = 14 400 data bytes follow.

4. Why big images are sent in bands

Printers have small receive buffers, and some firmware limits how many rows one GS v 0 command may contain. Elysano therefore splits tall images into bands of 128 rows, each with its own GS v 0 header. The printer prints them back to back with no visible seam. Data is also sent over USB in 4 KB chunks so slow printers can keep up.

5. Feed and cut

1B 64 04        ESC d 4   — print and feed 4 lines
1D 56 42 03     GS V B 3  — feed to the cutter (+3) and cut

The feed moves the image past the tear bar or cutter. GS V with function B feeds to the cutting position plus n motion units and performs a (usually partial) cut. Printers without a cutter ignore it.

6. The text test print

Elysano's Test print (text) sends plain text between formatting commands — ESC ! 0x30 switches to double-height, double-width characters for the title and ESC ! 0x00 switches back. If text prints but images don't, the connection is fine and the problem is image width or the printer's support for GS v 0.

Older printers: ESC * instead of GS v 0

A few very old or very cheap printers don't implement GS v 0 and only support the column-based ESC * bit-image mode, which sends the image in vertical strips of 8 or 24 dots. If an otherwise working printer prints nothing or random characters for images, that is the likely reason. You can export the raw job with Elysano's Download .bin button to inspect or replay it with other tools.