Image helper

Module escpos.image

Image format handling class

This module contains the image format handler EscposImage.

author:Michael Billington
organization:python-escpos
copyright:Copyright (c) 2016 Michael Billington <michael.billington@gmail.com>
license:GNU GPL v3
class escpos.image.EscposImage(img_source)

Bases: object

Load images in, and output ESC/POS formats.

The class is designed to efficiently delegate image processing to PIL, rather than spend CPU cycles looping over pixels.

height

Height of image in pixels

split(fragment_height)

Split an image into multiple fragments after fragment_height pixels

Parameters:fragment_height – height of fragment
Returns:list of PIL objects
to_column_format(high_density_vertical=True)

Extract slices of an image as equal-sized blobs of column-format data.

Parameters:high_density_vertical – Printed line height in dots
to_raster_format()

Convert image to raster-format binary

width

Width of image in pixels

width_bytes

Width of image if you use 8 pixels per byte and 0-pad at the end.