Skip to content

Commit 4953679

Browse files
committed
allow rotating imgage before printing it
1 parent bc51b6e commit 4953679

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

epson_printer/epsonprinter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,17 @@ def print_images(self, *printable_images):
264264
printable_image = reduce(lambda x, y: x.append(y), list(printable_images))
265265
self.print_image(printable_image)
266266

267-
def print_image_from_file(self, image_file):
267+
def print_image_from_file(self, image_file, rotate=False):
268268
image = Image.open(image_file)
269+
if rotate:
270+
image.rotate(180)
269271
printable_image = PrintableImage.from_image(image)
270272
self.print_image(printable_image)
271273

272-
def print_image_from_buffer(self, data):
274+
def print_image_from_buffer(self, data, rotate=False):
273275
image = Image.open(io.BytesIO(base64.b64decode(data)))
276+
if rotate:
277+
image.rotate(180)
274278
printable_image = PrintableImage.from_image(image)
275279
self.print_image(printable_image)
276280

0 commit comments

Comments
 (0)