mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 05:34:36 +03:00
Ensure image is loaded in remap_palette
This commit is contained in:
parent
804183c248
commit
6db0e96102
|
@ -582,6 +582,10 @@ class TestImage:
|
||||||
assert ext_individual == ext_multiple
|
assert ext_individual == ext_multiple
|
||||||
|
|
||||||
def test_remap_palette(self):
|
def test_remap_palette(self):
|
||||||
|
# Test identity transform
|
||||||
|
with Image.open("Tests/images/hopper.gif") as im:
|
||||||
|
assert_image_equal(im, im.remap_palette(list(range(256))))
|
||||||
|
|
||||||
# Test illegal image mode
|
# Test illegal image mode
|
||||||
with hopper() as im:
|
with hopper() as im:
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
|
|
|
@ -1796,6 +1796,7 @@ class Image:
|
||||||
|
|
||||||
if source_palette is None:
|
if source_palette is None:
|
||||||
if self.mode == "P":
|
if self.mode == "P":
|
||||||
|
self.load()
|
||||||
real_source_palette = self.im.getpalette("RGB")[:768]
|
real_source_palette = self.im.getpalette("RGB")[:768]
|
||||||
else: # L-mode
|
else: # L-mode
|
||||||
real_source_palette = bytearray(i // 3 for i in range(768))
|
real_source_palette = bytearray(i // 3 for i in range(768))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user