[Python-modules-commits] [willow] 04/11: Convert 1 and P to RGB when saving JPEG files

Christopher Stuart Hoskin mans0954 at moszumanska.debian.org
Tue Dec 5 23:12:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

mans0954 pushed a commit to tag v0.1.1
in repository willow.

commit 0b31f85be514431c1ef4ff9c5b10b918b0de3669
Author: Karl Hobley <karlhobley10 at gmail.com>
Date:   Wed Feb 18 16:15:42 2015 +0000

    Convert 1 and P to RGB when saving JPEG files
---
 willow/backends/pillow.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/willow/backends/pillow.py b/willow/backends/pillow.py
index 55bea12..fbe58ac 100644
--- a/willow/backends/pillow.py
+++ b/willow/backends/pillow.py
@@ -62,6 +62,9 @@ def pillow_crop(backend, left, top, right, bottom):
 
 @PillowBackend.register_operation('save_as_jpeg')
 def pillow_save_as_jpeg(backend, f, quality=85):
+    if backend.image.mode in ['1', 'P']:
+        backend.image = backend.image.convert('RGB')
+
     backend.image.save(f, 'JPEG', quality=quality)
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/willow.git



More information about the Python-modules-commits mailing list