pbmtoescp2
Convert PBM image to Epson ESC/P2 format
TLDR
Convert a PBM image to a ESC/P2 printer file
Specify the compression of the output
Specify the horizontal and vertical resolution of the output in dots per inch
Place a formfeed command at the end of the output
SYNOPSIS
pbmtoescp2 [-res=dpi|-density=dpi] [-page|-size={a4|letter|legal|executive|user|wider}] [-left=leftmm] [-top=topmm] [-rotation={0|90|180|270}] [-xpos=xmm] [-ypos=ymm] [-mirror] [-noverbose] [-help] [pbmfile]
PARAMETERS
-res=dpi or -density=dpi
Set horizontal resolution in DPI (1-288, default 72). Vertical matches horizontal.
-page or -size={a4|letter|legal|executive|user|wider}
Select page size (default: letter). 'user' uses image dimensions; 'wider' for 13.3" wide.
-left=leftmm
Left margin in mm from printable area left edge (default: 0).
-top=topmm
Top margin in mm from printable area top (default: 0).
-rotation={0|90|180|270}
Rotate image clockwise in degrees (default: 0).
-xpos=xmm
Absolute X position in mm from left (overrides -left).
-ypos=ymm
Absolute Y position in mm from top (overrides -top).
-mirror
Mirror image horizontally.
-noverbose
Suppress verbose progress messages.
-help
Display usage summary and exit.
DESCRIPTION
pbmtoescp2 is a utility from the Netpbm graphics package that converts Portable Bitmap (PBM) images—simple black-and-white bitmaps—into Epson's ESC/P2 printer control language. ESC/P2 is a raster graphics protocol used by many Epson dot-matrix, impact, and early inkjet printers for high-quality monochrome printing.
This command enables direct printing of PBM images to compatible hardware via a serial/parallel port, USB printer device, or file output for spoolers. It's ideal for embedded systems, legacy printing setups, or batch processing where GUI tools are unavailable.
Key features include customizable resolution (up to 288 dpi), page sizes (A4, letter, etc.), margins, rotation (0/90/180/270 degrees), absolute positioning, and horizontal mirroring. Input is read from stdin or a file; output goes to stdout. Verbose mode provides printing progress. No color support, as PBM and ESC/P2 are monochrome-only.
Common workflow: generate PBM with tools like pbmmask or pnmscale, pipe to pbmtoescp2, send to /dev/lp0. Limitations include printer-specific compatibility; test with your model.
CAVEATS
Monchrome only; requires ESC/P2-compatible Epson printer (e.g., LQ-series, SQ-series). Max resolution printer-dependent. No error-checking for invalid DPI/page combos. Image must fit page after scaling/rotation.
INPUT/OUTPUT
Reads PBM from pbmfile or stdin; writes ESC/P2 to stdout. Example: pbmmask image.pbm | pbmtoescp2 -res=144 | lp
PRINTER COMPATIBILITY
Supports Epson models like LQ-570, LQ-850, SQ-870, DFX-5000, many 9/24-pin dot-matrix. Check manual for ESC/P2 raster mode.
HISTORY
Developed by Mattias Ellert in 2002 for Netpbm suite (version ~9.21). Added ESC/P2 support beyond older ESC/P. Maintained in Netpbm releases; usage peaked in early 2000s Linux printing before CUPS dominance.
SEE ALSO
pbmtoepson(1), pgmtoescp(1), escp2topbm(1), pnmtopcl(1), pbmtolj(1)


