mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +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
|
import math
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image, ImageTransform
|
||||||
|
|
||||||
from .helper import PillowTestCase, hopper
|
from .helper import PillowTestCase, hopper
|
||||||
|
|
||||||
|
|
||||||
class TestImageTransform(PillowTestCase):
|
class TestImageTransform(PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
from PIL import ImageTransform
|
|
||||||
|
|
||||||
im = Image.new("L", (100, 100))
|
im = Image.new("L", (100, 100))
|
||||||
|
|
||||||
seq = tuple(range(10))
|
seq = tuple(range(10))
|
||||||
|
@ -22,6 +20,16 @@ class TestImageTransform(PillowTestCase):
|
||||||
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
|
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
|
||||||
im.transform((100, 100), transform)
|
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):
|
def test_extent(self):
|
||||||
im = hopper("RGB")
|
im = hopper("RGB")
|
||||||
(w, h) = im.size
|
(w, h) = im.size
|
||||||
|
|
|
@ -2282,6 +2282,7 @@ class Image(object):
|
||||||
raise ValueError("missing method data")
|
raise ValueError("missing method data")
|
||||||
|
|
||||||
im = new(self.mode, size, fillcolor)
|
im = new(self.mode, size, fillcolor)
|
||||||
|
im.info = self.info.copy()
|
||||||
if method == MESH:
|
if method == MESH:
|
||||||
# list of quads
|
# list of quads
|
||||||
for box, quad in data:
|
for box, quad in data:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user