Allow saving as BigTIFF by radarhere · Pull Request #8642 · python-pillow/Pillow

Conversation

@radarhere

Resolves #4669

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

radarhere

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

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.

radarhere

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)

Choose a reason for hiding this comment

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

hugovk


.. versionadded:: 8.4.0

**bigtiff**

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

Choose a reason for hiding this comment

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

Ok, done.

This was referenced

Dec 31, 2024

Labels

2 participants

@radarhere @hugovk