mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-01 10:23:34 +03:00
Merge pull request #1435 from radarhere/tiff
Minor Tiff formatting changes
This commit is contained in:
commit
ca929bdfc0
|
@ -227,6 +227,7 @@ def _limit_rational(val, max_val):
|
||||||
_load_dispatch = {}
|
_load_dispatch = {}
|
||||||
_write_dispatch = {}
|
_write_dispatch = {}
|
||||||
|
|
||||||
|
|
||||||
class ImageFileDirectory_v2(collections.MutableMapping):
|
class ImageFileDirectory_v2(collections.MutableMapping):
|
||||||
"""This class represents a TIFF tag directory. To speed things up, we
|
"""This class represents a TIFF tag directory. To speed things up, we
|
||||||
don't decode tags unless they're asked for.
|
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])
|
setattr(ImageFileDirectory_v2, "write_" + name, _write_dispatch[idx])
|
||||||
del _load_dispatch, _write_dispatch, idx, name
|
del _load_dispatch, _write_dispatch, idx, name
|
||||||
|
|
||||||
|
|
||||||
# Legacy ImageFileDirectory support.
|
# Legacy ImageFileDirectory support.
|
||||||
class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
||||||
"""This class represents the **legacy** interface to a TIFF tag directory.
|
"""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):
|
def __init__(self, *args, **kwargs):
|
||||||
ImageFileDirectory_v2.__init__(self, *args, **kwargs)
|
ImageFileDirectory_v2.__init__(self, *args, **kwargs)
|
||||||
self._legacy_api = True
|
self._legacy_api = True
|
||||||
#insert deprecation warning here.
|
|
||||||
|
|
||||||
tags = property(lambda self: self._tags_v1)
|
tags = property(lambda self: self._tags_v1)
|
||||||
tagdata = property(lambda self: self._tagdata)
|
tagdata = property(lambda self: self._tagdata)
|
||||||
|
@ -735,6 +736,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
||||||
# undone -- switch this pointer when IFD_LEGACY_API == False
|
# undone -- switch this pointer when IFD_LEGACY_API == False
|
||||||
ImageFileDirectory = ImageFileDirectory_v1
|
ImageFileDirectory = ImageFileDirectory_v1
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Image plugin for TIFF files.
|
# Image plugin for TIFF files.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
||||||
class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
|
class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
|
@ -312,4 +313,3 @@ TYPES = {}
|
||||||
# 11: "float",
|
# 11: "float",
|
||||||
# 12: "double",
|
# 12: "double",
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ The :py:meth:`~PIL.Image.Image.save` method can take the following keyword argum
|
||||||
|
|
||||||
For compatibility with legacy code, a
|
For compatibility with legacy code, a
|
||||||
`~PIL.TiffImagePlugin.ImageFileDirectory_v1` object may be passed
|
`~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
|
..versionadded:: 3.0.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user