Skip to content

Commit

Permalink
Do not rearrange palette channels
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jul 9, 2021
1 parent be30792 commit 6bc4418
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Tests/test_file_gif.py
Expand Up @@ -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):
Expand Down
10 changes: 1 addition & 9 deletions src/PIL/GifImagePlugin.py
Expand Up @@ -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:
Expand Down

0 comments on commit 6bc4418

Please sign in to comment.