-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow saving as BigTIFF #8642
Conversation
@@ -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", |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://web.archive.org/web/20240706160214/https://www.awaresystems.be/imaging/tiff/bigtiff.html for a description of the header values.
docs/handbook/image-file-formats.rst
Outdated
@@ -1208,6 +1208,9 @@ The :py:meth:`~PIL.Image.Image.save` method can take the following keyword argum | |||
|
|||
.. versionadded:: 8.4.0 | |||
|
|||
**bigtiff** |
There was a problem hiding this comment.
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):
**bigtiff** | |
**big_tiff** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done.
Resolves #4669
Adds a keyword argument to allow TIFF images to be saved as BigTIFF -
im.save("out.tiff", big_tiff=True)