mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Merge pull request #7842 from radarhere/exif
This commit is contained in:
commit
9fec5d581d
|
@ -3712,7 +3712,7 @@ class Exif(_ExifBase):
|
||||||
# returns a dict with any single item tuples/lists as individual values
|
# returns a dict with any single item tuples/lists as individual values
|
||||||
return {k: self._fixup(v) for k, v in src_dict.items()}
|
return {k: self._fixup(v) for k, v in src_dict.items()}
|
||||||
|
|
||||||
def _get_ifd_dict(self, offset):
|
def _get_ifd_dict(self, offset, group=None):
|
||||||
try:
|
try:
|
||||||
# an offset pointer to the location of the nested embedded IFD.
|
# an offset pointer to the location of the nested embedded IFD.
|
||||||
# It should be a long, but may be corrupted.
|
# It should be a long, but may be corrupted.
|
||||||
|
@ -3722,7 +3722,7 @@ class Exif(_ExifBase):
|
||||||
else:
|
else:
|
||||||
from . import TiffImagePlugin
|
from . import TiffImagePlugin
|
||||||
|
|
||||||
info = TiffImagePlugin.ImageFileDirectory_v2(self.head)
|
info = TiffImagePlugin.ImageFileDirectory_v2(self.head, group=group)
|
||||||
info.load(self.fp)
|
info.load(self.fp)
|
||||||
return self._fixup_dict(info)
|
return self._fixup_dict(info)
|
||||||
|
|
||||||
|
@ -3794,14 +3794,14 @@ class Exif(_ExifBase):
|
||||||
|
|
||||||
# get EXIF extension
|
# get EXIF extension
|
||||||
if ExifTags.IFD.Exif in self:
|
if ExifTags.IFD.Exif in self:
|
||||||
ifd = self._get_ifd_dict(self[ExifTags.IFD.Exif])
|
ifd = self._get_ifd_dict(self[ExifTags.IFD.Exif], ExifTags.IFD.Exif)
|
||||||
if ifd:
|
if ifd:
|
||||||
merged_dict.update(ifd)
|
merged_dict.update(ifd)
|
||||||
|
|
||||||
# GPS
|
# GPS
|
||||||
if ExifTags.IFD.GPSInfo in self:
|
if ExifTags.IFD.GPSInfo in self:
|
||||||
merged_dict[ExifTags.IFD.GPSInfo] = self._get_ifd_dict(
|
merged_dict[ExifTags.IFD.GPSInfo] = self._get_ifd_dict(
|
||||||
self[ExifTags.IFD.GPSInfo]
|
self[ExifTags.IFD.GPSInfo], ExifTags.IFD.GPSInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
return merged_dict
|
return merged_dict
|
||||||
|
@ -3835,7 +3835,7 @@ class Exif(_ExifBase):
|
||||||
elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]:
|
elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]:
|
||||||
offset = self._hidden_data.get(tag, self.get(tag))
|
offset = self._hidden_data.get(tag, self.get(tag))
|
||||||
if offset is not None:
|
if offset is not None:
|
||||||
self._ifds[tag] = self._get_ifd_dict(offset)
|
self._ifds[tag] = self._get_ifd_dict(offset, tag)
|
||||||
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)
|
||||||
|
@ -3917,7 +3917,7 @@ class Exif(_ExifBase):
|
||||||
self._ifds[tag] = makernote
|
self._ifds[tag] = makernote
|
||||||
else:
|
else:
|
||||||
# Interop
|
# Interop
|
||||||
self._ifds[tag] = self._get_ifd_dict(tag_data)
|
self._ifds[tag] = self._get_ifd_dict(tag_data, tag)
|
||||||
ifd = self._ifds.get(tag, {})
|
ifd = self._ifds.get(tag, {})
|
||||||
if tag == ExifTags.IFD.Exif and self._hidden_data:
|
if tag == ExifTags.IFD.Exif and self._hidden_data:
|
||||||
ifd = {
|
ifd = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user