mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Document new ExifTags enums
This commit is contained in:
parent
818e967fec
commit
5c482e20af
|
@ -37,7 +37,15 @@ which provide constants and clear-text names for various well-known EXIF tags.
|
||||||
>>> IFD.Exif.value
|
>>> IFD.Exif.value
|
||||||
34665
|
34665
|
||||||
>>> IFD(34665).name
|
>>> IFD(34665).name
|
||||||
'Exif'
|
'Exif
|
||||||
|
|
||||||
|
.. py:data:: LightSource
|
||||||
|
|
||||||
|
>>> from PIL.ExifTags import LightSource
|
||||||
|
>>> LightSource.Unknown.value
|
||||||
|
0
|
||||||
|
>>> LightSource(0).name
|
||||||
|
'Unknown'
|
||||||
|
|
||||||
Two of these values are also exposed as dictionaries.
|
Two of these values are also exposed as dictionaries.
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,34 @@ removes the hidden RGB values for better compression by default in libwebp 0.5
|
||||||
or later. By setting this option to ``True``, the encoder will keep the hidden
|
or later. By setting this option to ``True``, the encoder will keep the hidden
|
||||||
RGB values.
|
RGB values.
|
||||||
|
|
||||||
|
Added IFD, Interop and LightSource ExifTags enums
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
:py:data:`~PIL.ExifTags.IFD` has been added, allowing enums to be used with
|
||||||
|
:py:meth:`~PIL.Image.Exif.get_ifd`::
|
||||||
|
|
||||||
|
from PIL import Image, ExifTags
|
||||||
|
im = Image.open("Tests/images/flower.jpg")
|
||||||
|
print(im.getexif().get_ifd(ExifTags.IFD.Exif))
|
||||||
|
|
||||||
|
``IFD1`` can also be used with :py:meth:`~PIL.Image.Exif.get_ifd`, but it should
|
||||||
|
not be used in other contexts, as the enum value is only internally meaningful.
|
||||||
|
|
||||||
|
:py:data:`~PIL.ExifTags.Interop` has been added for tags within the Interop IFD::
|
||||||
|
|
||||||
|
from PIL import Image, ExifTags
|
||||||
|
im = Image.open("Tests/images/flower.jpg")
|
||||||
|
interop_ifd = im.getexif().get_ifd(ExifTags.IFD.Interop)
|
||||||
|
print(interop_ifd.get(ExifTags.Interop.InteropIndex)) # R98
|
||||||
|
|
||||||
|
:py:data:`~PIL.ExifTags.LightSource` has been added for values within the LightSource
|
||||||
|
tag::
|
||||||
|
|
||||||
|
from PIL import Image, ExifTags
|
||||||
|
im = Image.open("Tests/images/iptc.jpg")
|
||||||
|
exif_ifd = im.getexif().get_ifd(ExifTags.IFD.Exif)
|
||||||
|
print(ExifTags.LightSource(exif_ifd[0x9208])) # LightSource.Unknown
|
||||||
|
|
||||||
getxmp()
|
getxmp()
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user