-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow JPEGs with padding at image end.
Some JPEGs (e.g. Sony Alpha 6000) pad the end of the JPEG image with null bytes, instead of the JPEG End-Of-Image marker 0xFFD9. Others apparently do the same thing, but with 0xFF instead of 0x00. Due to strict sanity checks, this lead to otherwise valid JPEGs returning PARSE_EXIF_ERROR_NO_JPEG. This commit loosens the sanity check and handles the case of 0x00/0xFF padding at the end of image, and fixes #9, fixes #7.
- Loading branch information
Mayank Lahiri
committed
Nov 14, 2015
1 parent
6c5d9d9
commit 2315ffe
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Camera make : SONY | ||
Camera model : ILCE-6000 | ||
Software : ILCE-6000 v1.00 | ||
Bits per sample : 0 | ||
Image width : 6000 | ||
Image height : 4000 | ||
Image description : | ||
Image orientation : 1 | ||
Image copyright : | ||
Image date/time : 2014:04:18 20:33:53 | ||
Original date/time : 2014:04:18 20:33:53 | ||
Digitize date/time : 2014:04:18 20:33:53 | ||
Subsecond time : | ||
Exposure time : 1/0 s | ||
F-stop : f/8.0 | ||
ISO speed : 100 | ||
Subject distance : 0.000000 m | ||
Exposure bias : 0.000000 EV | ||
Flash used? : 1 | ||
Metering mode : 5 | ||
Lens focal length : 22.000000 mm | ||
35mm focal length : 33 mm | ||
GPS Latitude : 0.000000 deg (0.000000 deg, 0.000000 min, 0.000000 sec ?) | ||
GPS Longitude : 0.000000 deg (0.000000 deg, 0.000000 min, 0.000000 sec ?) | ||
GPS Altitude : 0.000000 m | ||
Lens min focal length: 16.000000 mm | ||
Lens max focal length: 50.000000 mm | ||
Lens f-stop min : f/3.5 | ||
Lens f-stop max : f/5.6 | ||
Lens make : | ||
Lens model : E PZ 16-50mm F3.5-5.6 OSS |
There's no guarantee that 0xFFD9 EOI marker would be found as expected here.
Samsung add their own trailer 'Image_UTC_Data' and I'm not sure whether it's wise to handle and maintain a different use case for every manufacturer.
I commented this sanity check and I'm currently rely on 'PARSE_EXIF_ERROR_NO_EXIF' error code.