From 4584e3138a6961956110a062496ca0f67f7b537d Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 6 Apr 2016 21:39:46 +1000 Subject: [PATCH] switch default image format to bitImageRaster Printers which don't have native QR rendering are less likely to support the newer GS ( L graphics command. --- escpos/escpos.py | 2 +- test/test_function_qr_native.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/escpos/escpos.py b/escpos/escpos.py index 6ff75bf..088cfe2 100644 --- a/escpos/escpos.py +++ b/escpos/escpos.py @@ -49,7 +49,7 @@ class Escpos(object): """ pass - def image(self, img_source, high_density_vertical = True, high_density_horizontal = True, impl = "graphics"): + def image(self, img_source, high_density_vertical = True, high_density_horizontal = True, impl = "bitImageRaster"): """ Print an image :param img_source: PIL image or filename to load: `jpg`, `gif`, `png` or `bmp` diff --git a/test/test_function_qr_native.py b/test/test_function_qr_native.py index 8636e5e..7f24e42 100644 --- a/test/test_function_qr_native.py +++ b/test/test_function_qr_native.py @@ -76,10 +76,10 @@ def test_image(): """Test QR as image""" instance = printer.Dummy() instance.qr("1", native=False, size=1) - expected = b'\x1d(LO\x000p0\x01\x011\x17\x00\x17\x00\x00\x00\x00\x7f]\xfcA' \ - b'\x19\x04]it]et]ItA=\x04\x7fU\xfc\x00\x0c\x00y~t4\x7f =\xa84j\xd9\xf0' \ - b'\x05\xd4\x90\x00i(\x7f<\xa8A \xd8]\'\xc4]y\xf8]E\x80Ar\x94\x7fR@\x00\x00' \ - b'\x00\x1d(L\x02\x0002' + print(instance.output) + expected = b'\x1dv0\x00\x03\x00\x17\x00\x00\x00\x00\x7f]\xfcA\x19\x04]it]et' \ + b']ItA=\x04\x7fU\xfc\x00\x0c\x00y~t4\x7f =\xa84j\xd9\xf0\x05\xd4\x90\x00' \ + b'i(\x7f<\xa8A \xd8]\'\xc4]y\xf8]E\x80Ar\x94\x7fR@\x00\x00\x00' assert(instance.output == expected) @raises(ValueError)