Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.72 KB

escimages.md

File metadata and controls

60 lines (39 loc) · 1.72 KB

escimages

escimages extracts raster images from binary ESC/POS files.

All non-graphical elements of the receipt are ignored, and a pair of files is written (in PBM and PNG format) for each image found in the source file.

Installation

This utility is included with escpos-tools. See the escpos-tools documentation for installation instructions.

Usage

php escimages.php FILE

Example

$ php escimages.php receipt-with-logo.bin

The raster image from the input receipt is extracted:

receipt-with-logo-img.png

The same binary data, when sent to a printer, renders as below:

$ cat receipt-with-logo.bin > /dev/usb/lp0

receipt-with-logo-small.png

The input file used as an example here was generated by escpos-php, and is available here.

Further conversions

This utility will create raster images only. They can be printed back to a printer via escpos-php, or rendered to other formats with the ImageMagick convert utility.

In some cases, drivers convert text to a series of images before printing. To recover text from this type of receipt, the images from escimage can be stacked and sent through a suitable OCR tool.

For example, using tesseract:

rm *.pbm
php escimages.php input.bin
convert -append *.pbm pbm:- | tesseract - -

See also