From 3fc74ae03d36154a3612cab9353f9f3cf1530dd0 Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sun, 3 Sep 2017 10:04:49 +0200 Subject: Convert to RGB before saving as JPEG. Pillow 3.7 removes support for saving RGBA images as JPEG. Gbp-Pq: Name 0001-Convert-to-RGB-before-saving-as-JPEG.patch --- pydenticon/__init__.py | 3 +++ 1 file changed, 3 insertions(+) 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) -- cgit v1.2.3