mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +03:00
Replace constants with enums (#8611)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
parent
e7e5420e0a
commit
cf4110ff06
|
@ -1565,7 +1565,7 @@ class Image:
|
||||||
for subifd_offset in subifd_offsets:
|
for subifd_offset in subifd_offsets:
|
||||||
ifds.append((exif._get_ifd_dict(subifd_offset), subifd_offset))
|
ifds.append((exif._get_ifd_dict(subifd_offset), subifd_offset))
|
||||||
ifd1 = exif.get_ifd(ExifTags.IFD.IFD1)
|
ifd1 = exif.get_ifd(ExifTags.IFD.IFD1)
|
||||||
if ifd1 and ifd1.get(513):
|
if ifd1 and ifd1.get(ExifTags.Base.JpegIFOffset):
|
||||||
assert exif._info is not None
|
assert exif._info is not None
|
||||||
ifds.append((ifd1, exif._info.next))
|
ifds.append((ifd1, exif._info.next))
|
||||||
|
|
||||||
|
@ -1577,11 +1577,11 @@ class Image:
|
||||||
|
|
||||||
fp = self.fp
|
fp = self.fp
|
||||||
if ifd is not None:
|
if ifd is not None:
|
||||||
thumbnail_offset = ifd.get(513)
|
thumbnail_offset = ifd.get(ExifTags.Base.JpegIFOffset)
|
||||||
if thumbnail_offset is not None:
|
if thumbnail_offset is not None:
|
||||||
thumbnail_offset += getattr(self, "_exif_offset", 0)
|
thumbnail_offset += getattr(self, "_exif_offset", 0)
|
||||||
self.fp.seek(thumbnail_offset)
|
self.fp.seek(thumbnail_offset)
|
||||||
data = self.fp.read(ifd.get(514))
|
data = self.fp.read(ifd.get(ExifTags.Base.JpegIFByteCount))
|
||||||
fp = io.BytesIO(data)
|
fp = io.BytesIO(data)
|
||||||
|
|
||||||
with open(fp) as im:
|
with open(fp) as im:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user