Changeset - 4b3174d7b236
[Not reviewed]
0 1 0
Andrew Shadura - 7 years ago 2017-09-03 14:00:18
andrew.shadura@collabora.co.uk
PYD-8: Fix generation of JPEG identicons with Pillow 4.2.0+:

- Explicitly convert image to RGB before saving as JPEG.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pydenticon/__init__.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)