Skip to content

Commit b281c39

Browse files
committed
Merge remote-tracking branch 'origin/pr/1035'
2 parents 53a5385 + 6a56c0c commit b281c39

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/common/exif.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,14 +1057,16 @@ int dt_exif_write_blob(uint8_t *blob, uint32_t size, const char *path, const int
10571057
Exiv2::ExifData blobExifData;
10581058
Exiv2::ExifParser::decode(blobExifData, blob + 6, size);
10591059
Exiv2::ExifData::const_iterator end = blobExifData.end();
1060+
Exiv2::ExifData::iterator it;
10601061
for(Exiv2::ExifData::const_iterator i = blobExifData.begin(); i != end; ++i)
10611062
{
1063+
// add() does not override! we need to delete existing key first.
10621064
Exiv2::ExifKey key(i->key());
1063-
if(imgExifData.findKey(key) == imgExifData.end())
1064-
imgExifData.add(Exiv2::ExifKey(i->key()), &i->value());
1065+
if((it = imgExifData.findKey(key)) != imgExifData.end()) imgExifData.erase(it);
1066+
1067+
imgExifData.add(Exiv2::ExifKey(i->key()), &i->value());
10651068
}
10661069
// Remove thumbnail
1067-
Exiv2::ExifData::iterator it;
10681070
if((it = imgExifData.findKey(Exiv2::ExifKey("Exif.Thumbnail.Compression"))) != imgExifData.end())
10691071
imgExifData.erase(it);
10701072
if((it = imgExifData.findKey(Exiv2::ExifKey("Exif.Thumbnail.XResolution"))) != imgExifData.end())
@@ -1114,8 +1116,6 @@ int dt_exif_read_blob(uint8_t *buf, const char *path, const int imgid, const int
11141116
assert(image.get() != 0);
11151117
image->readMetadata();
11161118
Exiv2::ExifData &exifData = image->exifData();
1117-
// needs to be reset, even in dng mode, as the buffers are flipped during raw import
1118-
exifData["Exif.Image.Orientation"] = uint16_t(1);
11191119

11201120
// get rid of thumbnails
11211121
Exiv2::ExifThumb(exifData).erase();
@@ -1154,6 +1154,8 @@ int dt_exif_read_blob(uint8_t *buf, const char *path, const int imgid, const int
11541154
{
11551155
/* Delete various MakerNote fields only applicable to the raw file */
11561156

1157+
exifData["Exif.Image.Orientation"] = uint16_t(1);
1158+
11571159
// Canon color space info
11581160
if((pos = exifData.findKey(Exiv2::ExifKey("Exif.Canon.ColorSpace"))) != exifData.end())
11591161
exifData.erase(pos);

src/common/imageio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,16 @@ int dt_imageio_export_with_flags(const uint32_t imgid, const char *filename,
663663
buf.pre_monochrome_demosaiced);
664664
dt_dev_pixelpipe_create_nodes(&pipe, &dev);
665665
dt_dev_pixelpipe_synch_all(&pipe, &dev);
666-
dt_dev_pixelpipe_get_dimensions(&pipe, &dev, pipe.iwidth, pipe.iheight, &pipe.processed_width,
667-
&pipe.processed_height);
666+
668667
if(filter)
669668
{
670669
if(!strncmp(filter, "pre:", 4)) dt_dev_pixelpipe_disable_after(&pipe, filter + 4);
671670
if(!strncmp(filter, "post:", 5)) dt_dev_pixelpipe_disable_before(&pipe, filter + 5);
672671
}
672+
673+
dt_dev_pixelpipe_get_dimensions(&pipe, &dev, pipe.iwidth, pipe.iheight, &pipe.processed_width,
674+
&pipe.processed_height);
675+
673676
dt_show_times(&start, "[export] creating pixelpipe", NULL);
674677

675678
// find output color profile for this image:

0 commit comments

Comments
 (0)