mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Merge pull request #6543 from radarhere/remap_palette
This commit is contained in:
commit
f73499e475
|
@ -620,6 +620,7 @@ class TestImage:
|
||||||
|
|
||||||
im_remapped = im.remap_palette([1, 0])
|
im_remapped = im.remap_palette([1, 0])
|
||||||
assert im_remapped.info["transparency"] == 1
|
assert im_remapped.info["transparency"] == 1
|
||||||
|
assert len(im_remapped.getpalette()) == 6
|
||||||
|
|
||||||
# Test unused transparency
|
# Test unused transparency
|
||||||
im.info["transparency"] = 2
|
im.info["transparency"] = 2
|
||||||
|
|
|
@ -1949,11 +1949,7 @@ class Image:
|
||||||
|
|
||||||
m_im = m_im.convert("L")
|
m_im = m_im.convert("L")
|
||||||
|
|
||||||
# Internally, we require 256 palette entries.
|
m_im.putpalette(palette_bytes, palette_mode)
|
||||||
new_palette_bytes = (
|
|
||||||
palette_bytes + ((256 * bands) - len(palette_bytes)) * b"\x00"
|
|
||||||
)
|
|
||||||
m_im.putpalette(new_palette_bytes, palette_mode)
|
|
||||||
m_im.palette = ImagePalette.ImagePalette(palette_mode, palette=palette_bytes)
|
m_im.palette = ImagePalette.ImagePalette(palette_mode, palette=palette_bytes)
|
||||||
|
|
||||||
if "transparency" in self.info:
|
if "transparency" in self.info:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user