ianare / exif-py

Easy to use Python module to extract Exif metadata from digital image files.
BSD 3-Clause "New" or "Revised" License
833 stars 191 forks source link

Cropped JPEG: Unexpected/unhandled segment type or file content #99

Open AurimasF opened 5 years ago

AurimasF commented 5 years ago

Extracting EXIF data fails from cropped JPEG: Cropped.jpg

Cropped JPEG is generated with ImageMagick's (6.9.10-23 also tried 7.0.8-49) convert command: convert -crop +0-1330 Original.jpg Cropped.jpg Original

Sample script (tried with exifread 2.1.2, git, 1.4.2):

#!python
import exifread
from exifread import exif_log

exif_log.setup_logger(True, True)

path_name = 'Cropped.jpg'
f = open(path_name, 'rb')
tags = exifread.process_file(f, debug=True)
print(tags)

Output:

DEBUG JPEG format recognized data[0:2]=0xFFD8 DEBUG data[2]=0xFF data[3]=0xE0 data[6:10]=JFIF DEBUG Length offset is 16 DEBUG Added to zero DEBUG Set segment base to 0x14 DEBUG Segment base 0x14 DEBUG Got 0xFF and 0xEF instead DEBUG Increment base by 65537 DEBUG Segment base 0x10015 DEBUG Unexpected/unhandled segment type or file content. {}

This worked last year and earlier with various combinations of earlier versions of exif-py and ImageMagick. Various other EXIF programs work with both files.

ravado commented 1 year ago

Is there any update on this? I have the same behaviour