From 4fd0063a4da9419297434a511faa6584a469565f Mon Sep 17 00:00:00 2001 From: Romain Porte Date: Sat, 26 Aug 2017 21:45:54 +0200 Subject: [PATCH] Check image size before centering --- src/escpos/escpos.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index 6c5c7b9..c94125c 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -116,11 +116,11 @@ class Escpos(object): try: max_width = int(self.profile.profile_data['media']['width']['pixels']) - if center: - im.center(max_width) - if im.width > max_width: raise ImageWidthError('{} > {}'.format(im.width, max_width)) + + if center: + im.center(max_width) except KeyError: # If the printer's pixel width is not known, print anyways... pass