mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Copy palette to new image in transform()
This commit is contained in:
parent
eee0953bb3
commit
d1815377b8
|
@ -32,6 +32,11 @@ class TestImageTransform:
|
|||
new_im = im.transform((100, 100), transform)
|
||||
assert new_im.info["comment"] == comment
|
||||
|
||||
def test_palette(self):
|
||||
with Image.open("Tests/images/hopper.gif") as im:
|
||||
transformed = im.transform(im.size, Image.AFFINE, [1, 0, 0, 0, 1, 0])
|
||||
assert im.palette.palette == transformed.palette.palette
|
||||
|
||||
def test_extent(self):
|
||||
im = hopper("RGB")
|
||||
(w, h) = im.size
|
||||
|
|
|
@ -2479,6 +2479,8 @@ class Image:
|
|||
raise ValueError("missing method data")
|
||||
|
||||
im = new(self.mode, size, fillcolor)
|
||||
if self.mode == "P" and self.palette:
|
||||
im.palette = self.palette.copy()
|
||||
im.info = self.info.copy()
|
||||
if method == MESH:
|
||||
# list of quads
|
||||
|
|
Loading…
Reference in New Issue
Block a user