mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Only deprecate setting of TIFF image sizes
This commit is contained in:
parent
cea6ecfdbb
commit
6f44ae1d27
|
@ -69,6 +69,14 @@ class TestFileTiff(PillowTestCase):
|
||||||
self.assertEqual(str(e.exception),
|
self.assertEqual(str(e.exception),
|
||||||
"Not allowing setting of legacy api")
|
"Not allowing setting of legacy api")
|
||||||
|
|
||||||
|
def test_size(self):
|
||||||
|
filename = "Tests/images/pil168.tif"
|
||||||
|
im = Image.open(filename)
|
||||||
|
|
||||||
|
def set_size():
|
||||||
|
im.size = (256, 256)
|
||||||
|
self.assert_warning(DeprecationWarning, set_size)
|
||||||
|
|
||||||
def test_xyres_tiff(self):
|
def test_xyres_tiff(self):
|
||||||
filename = "Tests/images/pil168.tif"
|
filename = "Tests/images/pil168.tif"
|
||||||
im = Image.open(filename)
|
im = Image.open(filename)
|
||||||
|
|
|
@ -1049,6 +1049,19 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
"Return the current frame number"
|
"Return the current frame number"
|
||||||
return self.__frame
|
return self.__frame
|
||||||
|
|
||||||
|
@property
|
||||||
|
def size(self):
|
||||||
|
return self._size
|
||||||
|
|
||||||
|
@size.setter
|
||||||
|
def size(self, value):
|
||||||
|
warnings.warn(
|
||||||
|
'Setting the size of a TIFF image direcly is deprecated, and will '
|
||||||
|
'be removed in a future version. Use the resize method instead.',
|
||||||
|
DeprecationWarning
|
||||||
|
)
|
||||||
|
self._size = value
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
if self.use_load_libtiff:
|
if self.use_load_libtiff:
|
||||||
return self._load_libtiff()
|
return self._load_libtiff()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user