Bug #820

Samsung NX100 JPG exports have broken EXIF

Added by Pascal de Bruijn about 5 years ago. Updated almost 4 years ago.

Status:ClosedStart date:24 Apr 2012
Priority:NormalDue date:
Assignee:Andreas Huggel% Done:

100%

Category:exif
Target version:0.24

Description

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
...and-it-goes-on...
$

$ 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
...and-it-goes-on...
$

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:
http://files.pcode.nl/temp/samsung_nx100_samples/PMJ_20111126_0772.SRW

Sample JPG exported from Darktable based on the above SRW:
http://files.pcode.nl/temp/samsung_nx100_samples/PMJ_20111126_0772_01.jpg

Let me know if you need anything else.

Associated revisions

Revision 2743
Added by Andreas Huggel about 5 years ago

#820: Added SamsungPreview to the list of previews to potentially remove when encoding Exif metadata for JPEG.

Revision 2744
Added by Andreas Huggel about 5 years ago

#819: Added the PentaxDng Preview image to the tags potentially stripped when encoding the Exif metadata for JPEG (related to #820).

History

#1 Updated by Pascal de Bruijn about 5 years ago

Sorry, I forgot to mention that I tested this using Exiv2 0.22 with changeset r2621, r2632, r2638, r2642 and r2643 applied.

#2 Updated by Pascal de Bruijn about 5 years ago

I justed tested this with Exiv 0.23 and the above issues is still present.

#3 Updated by Andreas Huggel about 5 years ago

Pascal,

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.

Andreas

#4 Updated by Andreas Huggel about 5 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.

#5 Updated by Pascal de Bruijn about 5 years ago

I just applied r2743 and r2744 to my Exiv2 0.23 package builds for Ubuntu, and retested the above. I'm happy to report that everything works as expected now.

Thank you for your assistance.

#6 Updated by Andreas Huggel about 5 years ago

Thanks for re-testing.

#7 Updated by Robin Mills almost 4 years ago

  • Status changed from Resolved to Closed

Fixed in 0.24.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux