From 3f6528da077618facdc102b473c42956b5e65165 Mon Sep 17 00:00:00 2001 From: Joel Lehtonen Date: Sun, 1 Feb 2015 01:46:15 +0200 Subject: [PATCH] Support for images vertically longer than 256 pixels --- escpos/escpos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/escpos/escpos.py b/escpos/escpos.py index 2263458..045a4fd 100644 --- a/escpos/escpos.py +++ b/escpos/escpos.py @@ -41,7 +41,7 @@ class Escpos: buffer = "" self._raw(S_RASTER_N) - buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1], 0) + buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1]&0xff, size[1]>>8) self._raw(buffer.decode('hex')) buffer = "" @@ -68,7 +68,7 @@ class Escpos: if im.size[0] > 512: print ("WARNING: Image is wider than 512 and could be truncated at print time ") - if im.size[1] > 255: + if im.size[1] > 0xffff: raise ImageSizeError() im_border = self._check_image_size(im.size[0])