Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mezzanine thumbnail templatetag failing to save thumbnails of jpeg images with Pillow >= 4.2.0 #1781

Closed
brunobbbs opened this issue Jul 16, 2017 · 0 comments

Comments

@brunobbbs
Copy link

brunobbbs commented Jul 16, 2017

Hello,

I've the following environment:

  • Mezzanine 4.2.3
  • Django 1.10.7
  • Python 3.6.1
  • Pillow 4.2.1

This version of Mezzanine installed the Pillow above.

Before Pillow 4.2.0, attempting to save an RGBA image as JPEG would discard the alpha channel. From Pillow 3.4.0, a deprecation warning was shown. From Pillow 4.2.0, the deprecation warning is removed and an IOError is raised.

This deprecation was discussed on Pillow Issue 2609

This makes that the thumbnail of jpeg images doesn't be saved.

To fix this, my suggestion is remove the RGB to RGBA conversion on the line 390 if the image's filetype was JPG or JPEG as follow:

if image.mode not in ("P", "L", "RGBA") and filetype not in ("JPG", "JPEG"):

The Alpha channel for JPG/JPEG images is unnecessary since these images doesn't have transparency.

stephenmcd added a commit that referenced this issue Jul 18, 2017
Doesn't convert JPG/JPEG images to RGBA. resolve #1781
@brunobbbs brunobbbs changed the title Mezzanine thumbnail templatetag failing to save thumbnails of jpeg images with Pillow > 4.2.0 Mezzanine thumbnail templatetag failing to save thumbnails of jpeg images with Pillow >= 4.2.0 Aug 11, 2017
zt-initech pushed a commit to InitechSoftware/mezzanine that referenced this issue Dec 3, 2017
wbtuomela pushed a commit to wbtuomela/mezzanine that referenced this issue May 18, 2018
johnbywater pushed a commit to johnbywater/mezzanine that referenced this issue Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant