if you try and run the test without removing this tag, an error is raised from AppendingTiffWriter.
def fixOffsets(
self, count: int, isShort: bool = False, isLong: bool = False
) -> None:
if not isShort and not isLong:
msg = "offset is neither short nor long"
> raise RuntimeError(msg)
E RuntimeError: offset is neither short nor long
Extending AppendingTiffWriter to handle LONG8 offsets is made complicated as it explicitly only handles shorts and longs, and has duplicated code to achieve that.
Rather than just adding in rewriteLastLong8(), readLong8(), and adding an isLong8 parameter, I've reworked the internals of the class to pass around the field size in my first commit. That made adding support for LONG8 very straightforward in my second commit.
https://github.com/python-pillow/Pillow/blob/3f24276bf2ab8c29b2c3aa96f5bca2b60b9f3340/Tests/test_file_tiff.py#L110-L116
if you try and run the test without removing this tag, an error is raised from
AppendingTiffWriter
.Extending
AppendingTiffWriter
to handle LONG8 offsets is made complicated as it explicitly only handles shorts and longs, and has duplicated code to achieve that.https://github.com/python-pillow/Pillow/blob/3f24276bf2ab8c29b2c3aa96f5bca2b60b9f3340/src/PIL/TiffImagePlugin.py#L2143-L2151 https://github.com/python-pillow/Pillow/blob/3f24276bf2ab8c29b2c3aa96f5bca2b60b9f3340/src/PIL/TiffImagePlugin.py#L2153-L2159 https://github.com/python-pillow/Pillow/blob/3f24276bf2ab8c29b2c3aa96f5bca2b60b9f3340/src/PIL/TiffImagePlugin.py#L2198-L2200
Rather than just adding in
rewriteLastLong8()
,readLong8()
, and adding anisLong8
parameter, I've reworked the internals of the class to pass around the field size in my first commit. That made adding support for LONG8 very straightforward in my second commit.