Skip to content

Commit 6a9960e

Browse files
committed
Only update Python palette if rawmode was different to the mode
1 parent ec40c54 commit 6a9960e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/PIL/Image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,9 @@ def load(self) -> core.PixelAccess | None:
897897
else:
898898
self.im.putpalettealphas(self.info["transparency"])
899899
self.palette.mode = "RGBA"
900-
else:
900+
elif self.palette.mode != mode:
901+
# If the palette rawmode is different to the mode,
902+
# then update the Python palette data
901903
self.palette.palette = self.im.getpalette(
902904
self.palette.mode, self.palette.mode
903905
)

0 commit comments

Comments
 (0)