mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #4128 from radarhere/info
Copy info in Image.transform
This commit is contained in:
commit
54e57768ab
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user