-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #5302: Proper alpha-blending for jpeg #5324
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
Conversation
Strangely, the image from #5302 is white in the transparent parts, so I'm not sure what Pillow is doing. Anyway, 👍 from me, but I'm not sure where 2.0.1 fixes are going. |
This is passing and ready to merge. |
Just curious. Do we want to hardcode a white background, or should we be getting the color from an rcParam? |
I think adding an rcParam would just add complication to this. We already have an rcParam for the figure background ( |
That said, I suppose it could go to |
Right... that was the param I was thinking of. On Tue, Oct 27, 2015 at 11:05 AM, Michael Droettboom <
|
This now gets the background color from |
4d12580
to
3dea66d
Compare
The test failures are puzzling, and I can't reproduce locally. 😢 |
Perhaps add a useful message for the assert so that we can see what the value is? |
prints aren't getting caught by nosetests (I think it is some sort of option set by us). Add that stuff to the assert message so that the exception will print out the relevant message. |
When I first tried coming up with a patch, I tried using I opened up a new issue related to this #5335. |
Printing does work; it's just muddled between the dots: "num colors: 181". It does not print the corner pixel because the colour count assert has already failed. |
@QuLogic: Thanks for catching that. My hunch is there is some variability because it's lossy JPEG. I'll just increase the range somewhat. |
Fix #5302: Proper alpha-blending for jpeg
Do we want to backport this to 2.x? |
Sounds reasonable to me; it can be viewed as a bugfix. But it also makes me wonder whether saving a jpg with |
I guess this was not backported, then? |
Fix matplotlib#5302: Proper alpha-blending for jpeg Conflicts: lib/matplotlib/tests/test_image.py
Backported to v2.x via 1e437d3. |
Saving a JPEG with an alpha channel doesn't look right -- I think pillow just removes the alpha channel altogether and uses the rest of the RGB values as-is.
This blends RGBA images onto a white background before saving.
This is JPEG-specific since it's our only raster output file format that doesn't support alpha blending. If we ever grow another (unlikely) this will need to be duplicated there.