Samsung NX100 JPG exports have broken EXIF
|Status:||Closed||Start date:||24 Apr 2012|
|Assignee:||Andreas Huggel||% Done:|
When I load a Samsung NX100 SRW file into Darktable (1.0.x) and have it exported to JPG, exiv2 can't read back the EXIF information, while exiftool can.
$ exiv2 PMJ_20111126_0772.SRW
File name : PMJ_20111126_0772.SRW
File size : 27446848 Bytes
MIME type : image/x-samsung-srw
Image size : 4704 x 3124
Camera make : SAMSUNG
Camera model : NX100
Image timestamp : 2011:11:26 17:01:15
$ exiv2 PMJ_20111126_0772_01.jpg
File name : PMJ_20111126_0772_01.jpg
File size : 4786263 Bytes
MIME type : image/jpeg
Image size : 3072 x 2045
PMJ_20111126_0772_01.jpg: No Exif data found in the file
$ exiftool PMJ_20111126_0772_01.jpg
ExifTool Version Number : 8.60
File Name : PMJ_20111126_0772_01.jpg
Directory : .
File Size : 4.6 MB
File Modification Date/Time : 2012:04:24 22:53:56+02:00
File Permissions : rw-rw-r--
File Type : JPEG
When I start Darktable from a terminal, I do see these warnings while exporting an image:
Warning: Exif tag Exif.Photo.MakerNote not encoded
Warning: Exif tag Exif.Samsung2.0x0060 not encoded
Warning: Exif tag Exif.Samsung2.0x0080 not encoded
Warning: Exif tag Exif.Samsung2.0x00a0 not encoded
Warning: Exif tag Exif.Samsung2.0x00c0 not encoded
When I do the same thing for CR2 files from my Canon EOS 400D, I don't see those warnings, and the EXIF data in the JPG files is just fine too (it can be read back by exiv2 with no issues).
Sample Samsung NX100 SRW:
Sample JPG exported from Darktable based on the above SRW:
Let me know if you need anything else.
#820: Added SamsungPreview to the list of previews to potentially remove when encoding Exif metadata for JPEG.
#3 Updated by Andreas Huggel over 6 years ago
Sorry for only getting to this issue now. The attached JPEG image does not contain Exif metadata. It only has XMP properties and an ICC profile. Exiftool shows the information from the ICC profile, Exiv2 doesn't, that may be the difference you observed.
Next question is why not, I guess. While I'm not familiar with Darktable, the Exiv2 warnings you quoted by themselves do not explain that. But the error that you get when manually attempting a similar operation (with the attached files renamed to bug820.SRW and bug820.jpg) probably does:
$ exiv2 -v insert -S.SRW bug820.jpg File 1/1: bug820.jpg Writing Exif data from ./bug820.SRW to bug820.jpg Warning: Exif tag Exif.Photo.MakerNote not encoded Warning: Exif tag Exif.Samsung2.0x0060 not encoded Warning: Exif tag Exif.Samsung2.0x0080 not encoded Warning: Exif tag Exif.Samsung2.0x00a0 not encoded Warning: Exif tag Exif.Samsung2.0x00c0 not encoded bug820.jpg: Could not write metadata to file: Size of Exif JPEG segment is larger than 65535 bytes
The last line in the Exiv2 output means that even after removing a number of Exif tags, the resulting binary block is still too large to fit in a JPEG Exif segment and Exiv2 gives up. (More details about this are here: http://www.exiv2.org/doc/classExiv2_1_1ExifParser.html#296a8f2aa49297103667cc882450d1c2)
I suspect Darktable also receives this 'Size of Exif JPEG segment is larger than 65535 bytes' exception but ignores it.
As far as Exiv2 is concerned, I'll check if there is anything we can can strip from this SRW image so that the remaining Exif block fits into the JPEG segment. You can check with the Darktable team if my suspicion is correct and if so, suggest that they show the error rather than suppress it.
#4 Updated by Andreas Huggel over 6 years ago
- Category set to exif
- Status changed from New to Resolved
- Assignee set to Andreas Huggel
- Target version set to 0.24
- % Done changed from 0 to 100
With r2743 the above operation succeeds. Exiv2 now removes the large SamsungPreview from the makernote and with that it is able to encode the Exif data for JPEG.