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

Always save TIFF with contiguous planar configuration #5973

Merged
merged 1 commit into from Mar 27, 2022

Conversation

radarhere
Copy link
Member

Resolves #3622

If a TIFF image is opened with "separate" planar configuration, it is successfully read.

However, if that same image is saved, Pillow tries to keep the "separate" planar configuration from the input file, and the output image is broken.

This PR simply changes Pillow to always save "contiguous", and the output image is fixed.

@kmilos
Copy link
Contributor

kmilos commented Jan 18, 2022

The forced libtiff writer cannot preserve it either?

@radarhere
Copy link
Member Author

I don't know why the saved image is broken in main. However,

https://www.awaresystems.be/imaging/tiff/tifftags/planarconfiguration.html

The specification adds a warning that PlanarConfiguration=2 is not in widespread use and that Baseline TIFF readers are not required to support it.

So it seems like a good idea to avoid the "separate" setting for the sake of compatibility of our created images.

@kmilos
Copy link
Contributor

kmilos commented Jan 19, 2022

Yeah, it's ok to play it safe for this case. I was just wondering if there was a remote chance of preserving the original image configuration, but unfortunately don't have the time to experiment right now...

@hugovk hugovk merged commit 1bc0e1b into python-pillow:main Mar 27, 2022
@radarhere radarhere deleted the planar_configuration branch March 27, 2022 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlanarConfiguration save
3 participants