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

Allow saving as BigTIFF #8642

Merged
merged 3 commits into from
Dec 31, 2024
Merged

Allow saving as BigTIFF #8642

merged 3 commits into from
Dec 31, 2024

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Dec 30, 2024

Resolves #4669

Adds a keyword argument to allow TIFF images to be saved as BigTIFF - im.save("out.tiff", big_tiff=True)

@@ -582,7 +582,7 @@ class ImageFileDirectory_v2(_IFDv2Base):

def __init__(
self,
ifh: bytes = b"II\052\0\0\0\0\0",
ifh: bytes = b"II\x2A\x00\x00\x00\x00\x00",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same, I'm just changing it to the form seen elsewhere in this file.

ifh = self._prefix + self._pack("H", 43 if self._bigtiff else 42)
if self._bigtiff:
ifh += self._pack("HH", 8, 0)
ifh += self._pack("Q", 16) if self._bigtiff else self._pack("L", 8)
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -1208,6 +1208,9 @@ The :py:meth:`~PIL.Image.Image.save` method can take the following keyword argum

.. versionadded:: 8.4.0

**bigtiff**
Copy link
Member

Choose a reason for hiding this comment

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

I suggest adding an underscore to the public API for readability (and in the code):

Suggested change
**bigtiff**
**big_tiff**

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, done.

@hugovk hugovk merged commit c7026d9 into python-pillow:main Dec 31, 2024
48 checks passed
@radarhere radarhere deleted the bigtiff branch December 31, 2024 10:38
@radarhere radarhere mentioned this pull request Dec 31, 2024
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.

Saving TIFF in chunks
2 participants