From 7e076bcb5bda5ba1921b3856a951e89b613ec30b Mon Sep 17 00:00:00 2001 From: Tom Hunger Date: Mon, 2 Feb 2015 14:24:48 +0000 Subject: [PATCH] Flip image before RLE encoding. The printer prints upside-down. --- sirius/coding/image_encoding.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sirius/coding/image_encoding.py b/sirius/coding/image_encoding.py index 2459bd3..f6ddd2b 100644 --- a/sirius/coding/image_encoding.py +++ b/sirius/coding/image_encoding.py @@ -71,6 +71,7 @@ def rle_from_bw(bw_image): :param bw_image: A mode "1" PIL image. :returns: A 2-tuple of (number of pixels, RLE-encoded pixel data) """ + bw_image = bw_image.transpose(Image.ROTATE_180) pixels = list(bw_image.getdata()) # Group each run length into lists each list is (result of -- 2.47.3