Copy info in transform

This commit is contained in:
Andrew Murray 2019-10-10 20:22:41 +11:00
parent bb1fc75e55
commit b65fcb280a
2 changed files with 12 additions and 3 deletions

View File

@ -1,14 +1,12 @@
import math
from PIL import Image
from PIL import Image, ImageTransform
from .helper import PillowTestCase, hopper
class TestImageTransform(PillowTestCase):
def test_sanity(self):
from PIL import ImageTransform
im = Image.new("L", (100, 100))
seq = tuple(range(10))
@ -22,6 +20,16 @@ class TestImageTransform(PillowTestCase):
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
im.transform((100, 100), transform)
def test_info(self):
comment = b"File written by Adobe Photoshop\xa8 4.0"
im = Image.open("Tests/images/hopper.gif")
self.assertEqual(im.info["comment"], comment)
transform = ImageTransform.ExtentTransform((0, 0, 0, 0))
new_im = im.transform((100, 100), transform)
self.assertEqual(new_im.info["comment"], comment)
def test_extent(self):
im = hopper("RGB")
(w, h) = im.size

View File

@ -2293,6 +2293,7 @@ class Image(object):
raise ValueError("missing method data")
im = new(self.mode, size, fillcolor)
im.info = self.info.copy()
if method == MESH:
# list of quads
for box, quad in data: