From 72be09ee8482cdd19e0895f8f536854c2dafe535 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Tue, 12 Jun 2018 15:17:11 +0200 Subject: [PATCH] Fix scanning with python-pillow 4.2.0 python-pillow released new version (4.2.0), which forbids saving RGBA data to JPEG. This behavior breaks scanning by hp-scan. Output is: $ hp-scan -m color -s file Saving to file /home/zdohnal/hpscan001.jpg error: Error saving file: cannot write mode RGBA as JPEG (I/O) These RGBA data needs to be convert to RGB data before saving as JPEG (other formats - PNG, PNM, TIFF etc. - works fine, because they doesn't ignore A channel). https://bugs.launchpad.net/hplip/+bug/1741214 --- scan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scan.py b/scan.py index c33d84b..1ae4079 100755 --- a/scan.py +++ b/scan.py @@ -1078,6 +1078,7 @@ try: log.info("Saving to file %s" % output) try: + im = im.convert("RGB") im.save(output) except IOError as e: log.error("Error saving file: %s (I/O)" % e) -- 2.17.0