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

Block tile TIFF tags when saving #5839

Merged
merged 1 commit into from Nov 21, 2021
Merged

Block tile TIFF tags when saving #5839

merged 1 commit into from Nov 21, 2021

Conversation

radarhere
Copy link
Member

Resolves #5838

It is suggested in that issue that Pillow should automatically remove tile TIFF tags - rather than having both tile and strip tags saved to the same image.

So this PR removes TILEWIDTH, TILELENGTH, TILEOFFSETS and TILEBYTECOUNTS.

@kmilos
Copy link
Contributor

kmilos commented Nov 18, 2021

I haven't checked this - so Pillow never ever writes out tiles ATM, even when using libtiff?

LGTM otherwise

@kmilos
Copy link
Contributor

kmilos commented Nov 18, 2021

I ask because the alternative could be: if you detect (existing?) tile-based tags, one could force libtiff writing and remove the stripe-based ones instead, so you can potentially keep the original data arrangement?

@radarhere
Copy link
Member Author

When saving, whether using libtiff or not, strip tags are always set.

In encoding TIFF using libtiff, you can see a call to TIFFWriteScanline ("It is not possible to write scanlines to a file that uses a tiled organization").

And for another opinion, #672 (comment)

Pillow appears to support reading tiled tiff but not writing.

@kmilos
Copy link
Contributor

kmilos commented Nov 18, 2021

Indeed, so this PR is a "must have" then. 👍

@hugovk hugovk merged commit b692faf into python-pillow:main Nov 21, 2021
@hugovk
Copy link
Member

hugovk commented Nov 21, 2021

Thanks!

@radarhere radarhere deleted the tiff branch November 21, 2021 21:27
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.

Three TIFF tags cause display issues in GIS software
3 participants