Merge pull request #1435 from radarhere/tiff

Minor Tiff formatting changes
This commit is contained in:
wiredfool 2015-09-29 15:43:40 +01:00
commit ca929bdfc0
3 changed files with 42 additions and 40 deletions

View File

@ -227,6 +227,7 @@ def _limit_rational(val, max_val):
_load_dispatch = {}
_write_dispatch = {}
class ImageFileDirectory_v2(collections.MutableMapping):
"""This class represents a TIFF tag directory. To speed things up, we
don't decode tags unless they're asked for.
@ -644,6 +645,7 @@ for idx, name in TYPES.items():
setattr(ImageFileDirectory_v2, "write_" + name, _write_dispatch[idx])
del _load_dispatch, _write_dispatch, idx, name
# Legacy ImageFileDirectory support.
class ImageFileDirectory_v1(ImageFileDirectory_v2):
"""This class represents the **legacy** interface to a TIFF tag directory.
@ -666,7 +668,6 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
def __init__(self, *args, **kwargs):
ImageFileDirectory_v2.__init__(self, *args, **kwargs)
self._legacy_api = True
#insert deprecation warning here.
tags = property(lambda self: self._tags_v1)
tagdata = property(lambda self: self._tagdata)
@ -735,6 +736,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
# undone -- switch this pointer when IFD_LEGACY_API == False
ImageFileDirectory = ImageFileDirectory_v1
##
# Image plugin for TIFF files.

View File

@ -19,6 +19,7 @@
from collections import namedtuple
class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
__slots__ = []
@ -312,4 +313,3 @@ TYPES = {}
# 11: "float",
# 12: "double",
# }

View File

@ -512,7 +512,7 @@ The :py:meth:`~PIL.Image.Image.save` method can take the following keyword argum
For compatibility with legacy code, a
`~PIL.TiffImagePlugin.ImageFileDirectory_v1` object may be passed
in this field. This will be deprecated in a future version.
in this field. However, this is deprecated.
..versionadded:: 3.0.0