ESC/POS command reference › GS v 0
GS v 0 (1D 76 30): print a logo or image on a receipt printer
The most widely used way to print a logo. You send a small header, then the image as rows of bits: 1 is a black dot, 0 is white.
| ASCII | GS v 0 m xL xH yL yH d1...dk |
| Hex | 1D 76 30 m xL xH yL yH d1...dk |
| Decimal | 29 118 48 m xL xH yL yH d1...dk |
Parameters
m | 0 = normal, 1 = double width, 2 = double height, 3 = both (0x30 to 0x33 also accepted by the viewer). |
xL xH | width in bytes, not dots: xL + xH × 256 = width in dots / 8, rounded up. |
yL yH | height in dots: yL + yH × 256. |
d1...dk | k = width in bytes × height. Rows top to bottom; in each byte the most significant bit is the leftmost dot. |
What it does
Convert the image to black and white first (threshold or dithering), pad each row to a multiple of 8 dots, then pack 8 dots per byte. Thermalink does this in its agent and sends one GS v 0 per image, and its output is tested pixel for pixel against the viewer.
The printable width is fixed: commonly 576 dots on 80 mm paper and 384 on 58 mm. A wider image is clipped on the right, not scaled; the viewer warns when an image is too wide.
escpos-php uses GS v 0 for bitImage() (and notes it pads the right side when the width is not a multiple of 8). Its graphics() method uses the newer GS ( L command, which not every printer supports.
Example
A 64 × 32 dot test image: 8 bytes per row, 32 rows, 256 data bytes.
1B 61 01 1D 76 30 00 08 00 20 00 FF FF FF FF FF FF FF FF F0 00 00 00 00 00 00 01 9C 00 00 00 00 00 00 01 87 00 00 00 00 00 00 01 81 C0 00 00 00 00 00 01 80 70 00 00 00 00 00 01 80 1C 00 00 00 00 00 01 80 07 00 00 00 00 00 01 80 01 C0 00 00 FF FF 01 80 00 70 00 00 FF FF 01 80 00 1C 00 00 FF FF 01 80 00 07 00 00 FF FF 01 80 00 01 C0 00 FF FF 01 80 00 00 70 00 FF FF 01 80 00 00 1C 00 FF FF 01 80 00 00 07 00 FF FF 01 80 00 00 01 C0 FF FF 01 80 00 00 00 70 FF FF 01 80 00 00 00 1C FF FF 01 80 00 00 00 07 FF FF 01 80 00 00 00 01 FF FF 01 80 00 00 00 00 FF FF 01 80 00 00 00 00 FF FF 01 80 00 00 00 00 FF FF 01 80 00 00 00 00 01 C0 01 80 00 00 00 00 00 70 01 80 00 00 00 00 00 1C 01 80 00 00 00 00 00 07 01 80 00 00 00 00 00 01 C1 80 00 00 00 00 00 00 71 80 00 00 00 00 00 00 1D FF FF FF FF FF FF FF FF 0A 36 34 20 78 20 33 32 20 64 6F 74 20 69 6D 61 67 65 0A 1B 61 00
Preview drawn in your browser by the ESC/POS viewer's engine on 80 mm paper. Letters use a similar monospace font, not the printer's own. Open this example in the viewer to edit the bytes.
How the viewer decodes these bytes
| Command | What it does | Bytes |
|---|---|---|
| ESC a | Align center | 1B 61 01 |
| GS v 0 | Raster image 64×32 dots | 1D 76 30 00 08 00 20 00 FF FF FF FF FF FF FF FF F0 00 00 00 00 00 00 01 … |
| Text | "64 x 32 dot image" | 36 34 20 78 20 33 32 20 64 6F 74 20 69 6D 61 67 65 |
| ESC a | Align left | 1B 61 00 |
Sending it from code
JavaScript (bytes)
// rows: array of Uint8Array, one bit per dot, MSB = leftmost
function raster(rows, widthDots) {
const xb = Math.ceil(widthDots / 8), h = rows.length;
return [0x1d, 0x76, 0x30, 0, xb & 255, xb >> 8, h & 255, h >> 8, ...rows.flatMap(r => [...r])];
}PHP with escpos-php
$logo = EscposImage::load("logo.png");
$printer->bitImage($logo); // GS v 0Python (raw bytes)
def raster(rows, width_dots):
xb = (width_dots + 7) // 8
head = bytes([0x1d, 0x76, 0x30, 0, xb % 256, xb // 256, len(rows) % 256, len(rows) // 256])
return head + b"".join(rows)
Common mistakes
- Putting the width in dots into xL xH. It is bytes: a 576-dot-wide image is
48 00. - Sending a colour or greyscale image byte per pixel. Each byte is 8 dots.
- One huge image on a printer with a small buffer. Split tall images into bands of a few hundred rows, each with its own header.
Related commands
ESC a: center or right-align text on a receipt printerGS ( k: print a QR code on a receipt printerGS k: print EAN-13, UPC-A, CODE39 and CODE128 barcodes
Sources
- escpos-php,
Printer.php(MIT licence) - Thermalink agent output, printed on a BIXOLON SRP-352plusIII (Windows 11, USB)
I wrote this page from the open-source libraries above, Thermalink's own output and tests on my BIXOLON printer. It is not copied from Epson's manual. For model-specific details see Epson's official ESC/POS reference or your printer maker's manual. Last checked 22 November 2026.
Building receipts byte by byte? Thermalink lets a web app send the receipt as JSON and prints it silently, with QR codes, logos, cut and cash drawer ($49 one-time).