Skip to content

Commit cf4110f

Browse files
authored
Replace constants with enums (#8611)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
1 parent e7e5420 commit cf4110f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PIL/Image.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ def get_child_images(self) -> list[ImageFile.ImageFile]:
15651565
for subifd_offset in subifd_offsets:
15661566
ifds.append((exif._get_ifd_dict(subifd_offset), subifd_offset))
15671567
ifd1 = exif.get_ifd(ExifTags.IFD.IFD1)
1568-
if ifd1 and ifd1.get(513):
1568+
if ifd1 and ifd1.get(ExifTags.Base.JpegIFOffset):
15691569
assert exif._info is not None
15701570
ifds.append((ifd1, exif._info.next))
15711571

@@ -1577,11 +1577,11 @@ def get_child_images(self) -> list[ImageFile.ImageFile]:
15771577

15781578
fp = self.fp
15791579
if ifd is not None:
1580-
thumbnail_offset = ifd.get(513)
1580+
thumbnail_offset = ifd.get(ExifTags.Base.JpegIFOffset)
15811581
if thumbnail_offset is not None:
15821582
thumbnail_offset += getattr(self, "_exif_offset", 0)
15831583
self.fp.seek(thumbnail_offset)
1584-
data = self.fp.read(ifd.get(514))
1584+
data = self.fp.read(ifd.get(ExifTags.Base.JpegIFByteCount))
15851585
fp = io.BytesIO(data)
15861586

15871587
with open(fp) as im:

0 commit comments

Comments
 (0)