summaryrefslogtreecommitdiff
path: root/src/qcam
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-04 06:29:46 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-04 12:56:06 +0300
commit3ed0fced1f22bcdb9a0f05bbbc1e3b87017ac8c2 (patch)
treed5d860ae049460855e5d0968c80a13070caf06a0 /src/qcam
parentb3987620aa9cb1c357fad711fb8bd004b7c76197 (diff)
qcam: dng_writer: Write EXIF IFD as custom directory
The EXIF IFD is incorrectly chained to IFD 0 in addition to being a referenced as a sub IFD through the EXIFIFD tag. While the libtiff API doesn't clearly document why this happens, inspection of the TIFFWriteDirectory() source code show that the function treats the IFD being written as containing an image, which isn't correct for the EXIF IFD. Use TIFFWriteCustomDirectory() instead, which fixes the problem. The resulting DNG file can now be opened with darktable in addition to rawtherapee. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam')
-rw-r--r--src/qcam/dng_writer.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp
index ea4616f6..cbd8bed3 100644
--- a/src/qcam/dng_writer.cpp
+++ b/src/qcam/dng_writer.cpp
@@ -316,9 +316,7 @@ int DNGWriter::write(const char *filename, const Camera *camera,
TIFFSetField(tif, EXIFTAG_EXPOSURETIME, exposureTime);
}
- TIFFCheckpointDirectory(tif);
- exifIFDOffset = TIFFCurrentDirOffset(tif);
- TIFFWriteDirectory(tif);
+ TIFFWriteCustomDirectory(tif, &exifIFDOffset);
/* Update the IFD offsets and close the file. */
TIFFSetDirectory(tif, 0);