Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,15 @@ def test_multipage_compression(self) -> None:
assert im.size == (10, 10)
im.load()

def test_seek_remove_palette(self) -> None:
with Image.open("Tests/images/no_rows_per_strip.tif") as im:
assert im.mode == "P"
assert im.palette is not None

im.seek(1)
assert im.mode == "F"
assert im.palette is None

def test_save_tiff_with_jpegtables(self, tmp_path: Path) -> None:
# Arrange
outfile = tmp_path / "temp.tif"
Expand Down
2 changes: 2 additions & 0 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,8 @@ def _setup(self) -> None:
if self.mode in ["P", "PA"]:
palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]]
self.palette = ImagePalette.raw("RGB;L", b"".join(palette))
else:
self.palette = None


#
Expand Down