From 24e9961c4f68bdc676a5e7a2dde02460f8bd62c1 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 25 Sep 2024 18:45:16 +1000 Subject: [PATCH] Support writing LONG8 offsets --- Tests/test_file_tiff.py | 4 ---- src/PIL/TiffImagePlugin.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 44da25295ef..6d76ccca627 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -108,10 +108,6 @@ def test_bigtiff(self, tmp_path: Path) -> None: assert_image_equal_tofile(im, "Tests/images/hopper.tif") with Image.open("Tests/images/hopper_bigtiff.tif") as im: - # The data type of this file's StripOffsets tag is LONG8, - # which is not yet supported for offset data when saving multiple frames. - del im.tag_v2[273] - outfile = str(tmp_path / "temp.tif") im.save(outfile, save_all=True, append_images=[im], tiffinfo=im.tag_v2) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index 0fe55e426bb..a655bb741e7 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -2123,7 +2123,7 @@ def write(self, data: Buffer, /) -> int: def _fmt(self, field_size: int) -> str: try: - return {2: "H", 4: "L"}[field_size] + return {2: "H", 4: "L", 8: "Q"}[field_size] except KeyError: msg = "offset is not supported" raise RuntimeError(msg)