mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
Do not rearrange palette channels
This commit is contained in:
parent
8cc3ac3093
commit
bac474402c
|
@ -833,7 +833,7 @@ def test_palette_save_ImagePalette(tmp_path):
|
||||||
|
|
||||||
with Image.open(out) as reloaded:
|
with Image.open(out) as reloaded:
|
||||||
im.putpalette(palette)
|
im.putpalette(palette)
|
||||||
assert_image_equal(reloaded, im)
|
assert_image_equal(reloaded.convert("RGB"), im.convert("RGB"))
|
||||||
|
|
||||||
|
|
||||||
def test_save_I(tmp_path):
|
def test_save_I(tmp_path):
|
||||||
|
|
|
@ -396,15 +396,7 @@ def _normalize_palette(im, palette, info):
|
||||||
if isinstance(palette, (bytes, bytearray, list)):
|
if isinstance(palette, (bytes, bytearray, list)):
|
||||||
source_palette = bytearray(palette[:768])
|
source_palette = bytearray(palette[:768])
|
||||||
if isinstance(palette, ImagePalette.ImagePalette):
|
if isinstance(palette, ImagePalette.ImagePalette):
|
||||||
source_palette = bytearray(
|
source_palette = bytearray(palette.palette)
|
||||||
itertools.chain.from_iterable(
|
|
||||||
zip(
|
|
||||||
palette.palette[:256],
|
|
||||||
palette.palette[256:512],
|
|
||||||
palette.palette[512:768],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if im.mode == "P":
|
if im.mode == "P":
|
||||||
if not source_palette:
|
if not source_palette:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user