Skip to content

Commit

Permalink
Copy info in transform
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Oct 30, 2019
1 parent bb1fc75 commit b65fcb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Tests/test_image_transform.py
Original file line number Diff line number Diff line change
@@ -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))
Expand All @@ -22,6 +20,16 @@ def test_sanity(self):
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
Expand Down
1 change: 1 addition & 0 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,7 @@ def getdata(self):
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:
Expand Down

0 comments on commit b65fcb2

Please sign in to comment.