Merge pull request #4128 from radarhere/info

Copy info in Image.transform
This commit is contained in:
Hugo van Kemenade 2019-11-13 20:27:51 +02:00 committed by GitHub
commit 54e57768ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -2282,6 +2282,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: