Skip to content

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