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

JPEG Handling changes in PIL/Pillow #1803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zandeez
Copy link
Contributor

@zandeez zandeez commented Sep 18, 2017

Resolves the following:

  • JPEG images cannot be saved as RGBA
  • JPEG images may still be of a mode that we want to convert from
  • Padded images are always created RGBA which breaks JPEG

* JPEG images cannot be saved as RGBA
* JPEG images may still be of a mode that we want to convert from
* Padded images are always created RGBA which breaks JPEG
@stephenmcd
Copy link
Owner

I'm able to successfully generate thumbnails for jpegs without this change, can you provide more info on how to reproduce the problem?

@zandeez
Copy link
Contributor Author

zandeez commented May 11, 2018

Hi Stephen,

It looks like padded thumbnails are affected in particular.

{% thumbnail product.image 350 350 True 95 0.5 0.5 True "white" %}

Currently doesn't seem to generate a thumbnail, but does with the changes.

Thanks,

@stephenmcd
Copy link
Owner

I still can't reproduce the problem. I used the vars you specified for the thumbnail tag and I get a valid resized image, see:

screen shot 2018-05-15 at 11 42 04 am

@viaregio
Copy link
Contributor

If I remember correctly, the problem zandeez is describing occurs with newer versions of PIL/pillow.

@zandeez
Copy link
Contributor Author

zandeez commented Nov 9, 2018

Seems to be resolved Mezzanine 4.3.1, Pillow 5.3.0

@zandeez
Copy link
Contributor Author

zandeez commented Nov 9, 2018

Spoke too soon, it's not generating thumbnails for me from JPEG, even with this patch.

Python 3.6.7
Mezzanine 4.3.1
Pillow 5.3.0

@zandeez
Copy link
Contributor Author

zandeez commented Nov 9, 2018

Ignore me, the patch does work I hadn't applied it correctly.

Basically with the versions listed above, if thumbnailing with padding with a format that doesn't support RGBA (such as jpg) the thumbnail will not save. This patch forces jpegs to be RGB rather than RGBA which saves consistently.

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

Successfully merging this pull request may close these issues.

3 participants