Do not rearrange palette channels

This commit is contained in:
Andrew Murray 2021-07-10 00:00:50 +10:00 committed by Hugo van Kemenade
parent 8cc3ac3093
commit bac474402c
2 changed files with 2 additions and 10 deletions

View File

@ -833,7 +833,7 @@ def test_palette_save_ImagePalette(tmp_path):
with Image.open(out) as reloaded:
im.putpalette(palette)
assert_image_equal(reloaded, im)
assert_image_equal(reloaded.convert("RGB"), im.convert("RGB"))
def test_save_I(tmp_path):

View File

@ -396,15 +396,7 @@ def _normalize_palette(im, palette, info):
if isinstance(palette, (bytes, bytearray, list)):
source_palette = bytearray(palette[:768])
if isinstance(palette, ImagePalette.ImagePalette):
source_palette = bytearray(
itertools.chain.from_iterable(
zip(
palette.palette[:256],
palette.palette[256:512],
palette.palette[512:768],
)
)
)
source_palette = bytearray(palette.palette)
if im.mode == "P":
if not source_palette: