From 1e6eac40fc8dc680f2e3eb45f289aacea2f68f12 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 3 Oct 2019 20:23:49 +1000 Subject: [PATCH 1/3] Changed condition to use DEBUG as a boolean --- src/PIL/TiffImagePlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index a927cd3ed..e03d5b105 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -854,7 +854,7 @@ class ImageFileDirectory_v2(MutableMapping): # pass 2: write entries to file for tag, typ, count, value, data in entries: - if DEBUG > 1: + if DEBUG: print(tag, typ, count, repr(value), repr(data)) result += self._pack("HHL4s", tag, typ, count, value) From 3cd7d9e4a2d474c4b8bd8c2e9b4bd2418298e002 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 3 Oct 2019 20:54:55 +1000 Subject: [PATCH 2/3] Removed outdated VERSION comment --- src/PIL/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 2acf4f496..fd02b40d9 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -9,7 +9,6 @@ PIL is the Python Imaging Library by Fredrik Lundh and Contributors. Copyright (c) 1999 by Secret Labs AB. Use PIL.__version__ for this Pillow version. -PIL.VERSION is the old PIL version and will be removed in the future. ;-) """ From d6ae0a99a73c8d12a45e9f96023c7d57f3bc6607 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 3 Oct 2019 22:12:28 +1000 Subject: [PATCH 3/3] Removed deprecated setting of TIFF image sizes --- Tests/test_file_tiff.py | 9 --------- docs/deprecations.rst | 21 ++++++++------------- src/PIL/TiffImagePlugin.py | 13 ------------- 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 2d15de2bd..048539f86 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -73,15 +73,6 @@ class TestFileTiff(PillowTestCase): ifd.legacy_api = None self.assertEqual(str(e.exception), "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): filename = "Tests/images/pil168.tif" im = Image.open(filename) diff --git a/docs/deprecations.rst b/docs/deprecations.rst index 2ce2b5fa5..95c5cd3b1 100644 --- a/docs/deprecations.rst +++ b/docs/deprecations.rst @@ -81,19 +81,6 @@ Deprecated Deprecated Deprecated ``IptcImagePlugin.__version__`` ``PixarImagePlugin.__version__`` =============================== ================================= ================================== -Setting the size of TIFF images -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. deprecated:: 5.3.0 - -Setting the image size of a TIFF image (eg. ``im.size = (256, 256)``) issues -a ``DeprecationWarning``: - -.. code-block:: none - - Setting the size of a TIFF image directly is deprecated, and will - be removed in a future version. Use the resize method instead. - ImageCms.CmsProfile attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -127,6 +114,14 @@ PILLOW_VERSION constant ``PILLOW_VERSION`` has been removed. Use ``__version__`` instead. +Setting the size of TIFF images +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +*Removed in version 7.0.0.* + +Setting the size of a TIFF image directly (eg. ``im.size = (256, 256)``) throws +an error. Use ``Image.resize`` instead. + VERSION constant ~~~~~~~~~~~~~~~~ diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index a927cd3ed..b901bd06d 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -1079,19 +1079,6 @@ class TiffImageFile(ImageFile.ImageFile): """Return the current frame number""" 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 directly is deprecated, and will" - " be removed in a future version. Use the resize method instead.", - DeprecationWarning, - ) - self._size = value - def load(self): if self.use_load_libtiff: return self._load_libtiff()