Skip to content

Commit

Permalink
Merge pull request #4114 from radarhere/tiff_size
Browse files Browse the repository at this point in the history
Removed deprecated setting of TIFF image sizes
  • Loading branch information
radarhere committed Oct 4, 2019
2 parents 0a8f029 + d6ae0a9 commit 6a83d5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 35 deletions.
9 changes: 0 additions & 9 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ def test_set_legacy_api(self):
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)
Expand Down
21 changes: 8 additions & 13 deletions docs/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -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
~~~~~~~~~~~~~~~~

Expand Down
13 changes: 0 additions & 13 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,19 +1079,6 @@ def tell(self):
"""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()
Expand Down

0 comments on commit 6a83d5b

Please sign in to comment.