Concatenate multiple JPEG EXIF markers by radarhere · Pull Request #7496 · python-pillow/Pillow

Resolves #7495

The issue has found an image where multiple EXIF markers are present. This is against the specification -

https://en.wikipedia.org/wiki/Exif

Exif metadata are restricted in size to 64 kB in JPEG images because according to the specification this information must be contained within a single JPEG APP1 segment.

but this PR allows Pillow to be more flexible, and concatenates the two markers.

I created a test image with

from PIL import Image
im = Image.new("L", (1, 1))
im.save("multiple_exif.jpg", exif=b"Exif\x00\x00first", extra=b"\xFF\xE1\x00\x0EExif\x00\x00second")