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

@radarhere radarhere commented Nov 18, 2021

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 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 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

@radarhere radarhere commented Nov 18, 2021

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 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
49 checks passed
@hugovk
Copy link
Member

@hugovk hugovk commented Nov 21, 2021

Thanks!

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

3 participants