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

Added BigTIFF reading #6097

Merged
merged 2 commits into from Mar 11, 2022
Merged

Added BigTIFF reading #6097

merged 2 commits into from Mar 11, 2022

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Feb 28, 2022

Resolves #4513

See https://www.awaresystems.be/imaging/tiff/bigtiff.html for a documentation reference.

The test image was created with convert hopper.tif TIFF64:hopper_bigtiff.tif.

@radarhere radarhere added the TIFF label Feb 28, 2022
@@ -3458,10 +3460,18 @@ def _get_ifd_dict(self, offset):
return self._fixup_dict(info)

def _get_head(self):
version = b"\x2B" if self.bigtiff else b"\x2A"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\x2B is 43, and \x2A is 42, as per https://www.awaresystems.be/imaging/tiff/bigtiff.html

@@ -699,6 +704,7 @@ def _register_basic(idx_fmt_name):
(TiffTags.FLOAT, "f", "float"),
(TiffTags.DOUBLE, "d", "double"),
(TiffTags.IFD, "L", "long"),
(TiffTags.LONG8, "Q", "long8"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.awaresystems.be/imaging/tiff/bigtiff.html

The StripOffsets, StripByteCounts, TileOffsets, and TileByteCounts tags are allowed to have the datatype TIFF_LONG8 in BigTIFF.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Shall we add to release notes?

@hugovk hugovk merged commit 515957b into python-pillow:main Mar 11, 2022
@radarhere radarhere deleted the bigtiff branch March 11, 2022 21:07
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.

PIL cannot read BigTIFF
2 participants