Skip to content

Commit

Permalink
Support writing LONG8 offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 25, 2024
1 parent 0a99d63 commit 24e9961
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 2129 in src/PIL/TiffImagePlugin.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2127-L2129

Added lines #L2127 - L2129 were not covered by tests
Expand Down

0 comments on commit 24e9961

Please sign in to comment.