mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Merge pull request #8615 from radarhere/exiftags
This commit is contained in:
commit
1146190d75
|
@ -303,38 +303,38 @@ TAGS = {
|
||||||
|
|
||||||
|
|
||||||
class GPS(IntEnum):
|
class GPS(IntEnum):
|
||||||
GPSVersionID = 0
|
GPSVersionID = 0x00
|
||||||
GPSLatitudeRef = 1
|
GPSLatitudeRef = 0x01
|
||||||
GPSLatitude = 2
|
GPSLatitude = 0x02
|
||||||
GPSLongitudeRef = 3
|
GPSLongitudeRef = 0x03
|
||||||
GPSLongitude = 4
|
GPSLongitude = 0x04
|
||||||
GPSAltitudeRef = 5
|
GPSAltitudeRef = 0x05
|
||||||
GPSAltitude = 6
|
GPSAltitude = 0x06
|
||||||
GPSTimeStamp = 7
|
GPSTimeStamp = 0x07
|
||||||
GPSSatellites = 8
|
GPSSatellites = 0x08
|
||||||
GPSStatus = 9
|
GPSStatus = 0x09
|
||||||
GPSMeasureMode = 10
|
GPSMeasureMode = 0x0A
|
||||||
GPSDOP = 11
|
GPSDOP = 0x0B
|
||||||
GPSSpeedRef = 12
|
GPSSpeedRef = 0x0C
|
||||||
GPSSpeed = 13
|
GPSSpeed = 0x0D
|
||||||
GPSTrackRef = 14
|
GPSTrackRef = 0x0E
|
||||||
GPSTrack = 15
|
GPSTrack = 0x0F
|
||||||
GPSImgDirectionRef = 16
|
GPSImgDirectionRef = 0x10
|
||||||
GPSImgDirection = 17
|
GPSImgDirection = 0x11
|
||||||
GPSMapDatum = 18
|
GPSMapDatum = 0x12
|
||||||
GPSDestLatitudeRef = 19
|
GPSDestLatitudeRef = 0x13
|
||||||
GPSDestLatitude = 20
|
GPSDestLatitude = 0x14
|
||||||
GPSDestLongitudeRef = 21
|
GPSDestLongitudeRef = 0x15
|
||||||
GPSDestLongitude = 22
|
GPSDestLongitude = 0x16
|
||||||
GPSDestBearingRef = 23
|
GPSDestBearingRef = 0x17
|
||||||
GPSDestBearing = 24
|
GPSDestBearing = 0x18
|
||||||
GPSDestDistanceRef = 25
|
GPSDestDistanceRef = 0x19
|
||||||
GPSDestDistance = 26
|
GPSDestDistance = 0x1A
|
||||||
GPSProcessingMethod = 27
|
GPSProcessingMethod = 0x1B
|
||||||
GPSAreaInformation = 28
|
GPSAreaInformation = 0x1C
|
||||||
GPSDateStamp = 29
|
GPSDateStamp = 0x1D
|
||||||
GPSDifferential = 30
|
GPSDifferential = 0x1E
|
||||||
GPSHPositioningError = 31
|
GPSHPositioningError = 0x1F
|
||||||
|
|
||||||
|
|
||||||
"""Maps EXIF GPS tags to tag names."""
|
"""Maps EXIF GPS tags to tag names."""
|
||||||
|
@ -342,40 +342,40 @@ GPSTAGS = {i.value: i.name for i in GPS}
|
||||||
|
|
||||||
|
|
||||||
class Interop(IntEnum):
|
class Interop(IntEnum):
|
||||||
InteropIndex = 1
|
InteropIndex = 0x0001
|
||||||
InteropVersion = 2
|
InteropVersion = 0x0002
|
||||||
RelatedImageFileFormat = 4096
|
RelatedImageFileFormat = 0x1000
|
||||||
RelatedImageWidth = 4097
|
RelatedImageWidth = 0x1001
|
||||||
RelatedImageHeight = 4098
|
RelatedImageHeight = 0x1002
|
||||||
|
|
||||||
|
|
||||||
class IFD(IntEnum):
|
class IFD(IntEnum):
|
||||||
Exif = 34665
|
Exif = 0x8769
|
||||||
GPSInfo = 34853
|
GPSInfo = 0x8825
|
||||||
Makernote = 37500
|
MakerNote = 0x927C
|
||||||
Interop = 40965
|
Interop = 0xA005
|
||||||
IFD1 = -1
|
IFD1 = -1
|
||||||
|
|
||||||
|
|
||||||
class LightSource(IntEnum):
|
class LightSource(IntEnum):
|
||||||
Unknown = 0
|
Unknown = 0x00
|
||||||
Daylight = 1
|
Daylight = 0x01
|
||||||
Fluorescent = 2
|
Fluorescent = 0x02
|
||||||
Tungsten = 3
|
Tungsten = 0x03
|
||||||
Flash = 4
|
Flash = 0x04
|
||||||
Fine = 9
|
Fine = 0x09
|
||||||
Cloudy = 10
|
Cloudy = 0x0A
|
||||||
Shade = 11
|
Shade = 0x0B
|
||||||
DaylightFluorescent = 12
|
DaylightFluorescent = 0x0C
|
||||||
DayWhiteFluorescent = 13
|
DayWhiteFluorescent = 0x0D
|
||||||
CoolWhiteFluorescent = 14
|
CoolWhiteFluorescent = 0x0E
|
||||||
WhiteFluorescent = 15
|
WhiteFluorescent = 0x0F
|
||||||
StandardLightA = 17
|
StandardLightA = 0x11
|
||||||
StandardLightB = 18
|
StandardLightB = 0x12
|
||||||
StandardLightC = 19
|
StandardLightC = 0x13
|
||||||
D55 = 20
|
D55 = 0x14
|
||||||
D65 = 21
|
D65 = 0x15
|
||||||
D75 = 22
|
D75 = 0x16
|
||||||
D50 = 23
|
D50 = 0x17
|
||||||
ISO = 24
|
ISO = 0x18
|
||||||
Other = 255
|
Other = 0xFF
|
||||||
|
|
|
@ -3884,7 +3884,7 @@ class Exif(_ExifBase):
|
||||||
gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo)
|
gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo)
|
||||||
print(gps_ifd)
|
print(gps_ifd)
|
||||||
|
|
||||||
Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.Makernote``,
|
Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``,
|
||||||
``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``.
|
``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``.
|
||||||
|
|
||||||
:py:mod:`~PIL.ExifTags` also has enum classes to provide names for data::
|
:py:mod:`~PIL.ExifTags` also has enum classes to provide names for data::
|
||||||
|
@ -4047,11 +4047,11 @@ class Exif(_ExifBase):
|
||||||
ifd = self._get_ifd_dict(offset, tag)
|
ifd = self._get_ifd_dict(offset, tag)
|
||||||
if ifd is not None:
|
if ifd is not None:
|
||||||
self._ifds[tag] = ifd
|
self._ifds[tag] = ifd
|
||||||
elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.Makernote]:
|
elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.MakerNote]:
|
||||||
if ExifTags.IFD.Exif not in self._ifds:
|
if ExifTags.IFD.Exif not in self._ifds:
|
||||||
self.get_ifd(ExifTags.IFD.Exif)
|
self.get_ifd(ExifTags.IFD.Exif)
|
||||||
tag_data = self._ifds[ExifTags.IFD.Exif][tag]
|
tag_data = self._ifds[ExifTags.IFD.Exif][tag]
|
||||||
if tag == ExifTags.IFD.Makernote:
|
if tag == ExifTags.IFD.MakerNote:
|
||||||
from .TiffImagePlugin import ImageFileDirectory_v2
|
from .TiffImagePlugin import ImageFileDirectory_v2
|
||||||
|
|
||||||
if tag_data[:8] == b"FUJIFILM":
|
if tag_data[:8] == b"FUJIFILM":
|
||||||
|
@ -4138,7 +4138,7 @@ class Exif(_ExifBase):
|
||||||
ifd = {
|
ifd = {
|
||||||
k: v
|
k: v
|
||||||
for (k, v) in ifd.items()
|
for (k, v) in ifd.items()
|
||||||
if k not in (ExifTags.IFD.Interop, ExifTags.IFD.Makernote)
|
if k not in (ExifTags.IFD.Interop, ExifTags.IFD.MakerNote)
|
||||||
}
|
}
|
||||||
return ifd
|
return ifd
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user