summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shadura <andrewsh@debian.org>2017-09-03 10:04:49 +0200
committerAndrew Shadura <andrewsh@debian.org>2017-09-03 10:16:48 +0200
commit3fc74ae03d36154a3612cab9353f9f3cf1530dd0 (patch)
treeee111ec08630c85949860325c4f5466837dd9a91
parenta8ce584f002742daf5560f75dee659444e223822 (diff)
Convert to RGB before saving as JPEG.archive/debian/0.3-2
Pillow 3.7 removes support for saving RGBA images as JPEG. Gbp-Pq: Name 0001-Convert-to-RGB-before-saving-as-JPEG.patch
-rw-r--r--pydenticon/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pydenticon/__init__.py b/pydenticon/__init__.py
index 0edfdb0..f499988 100644
--- a/pydenticon/__init__.py
+++ b/pydenticon/__init__.py
@@ -246,6 +246,9 @@ class Generator(object):
# Set-up a stream where image will be saved.
stream = BytesIO()
+ if image_format.upper() == "JPEG":
+ image = image.convert(mode="RGB")
+
# Save the image to stream.
try:
image.save(stream, format=image_format, optimize=True)