metadata: do not accidentally remove exif tags when embedding the arp sidecar in XMP

Fixes #127

(cherry picked from commit 49cbe9bd19db558a4be36221472cbb5e78aa95a2)
This commit is contained in:
Alberto Griggio
2020-09-17 23:17:45 -07:00
committed by Lawrence Lee
parent 393dbcf9f9
commit 322e709bcb
3 changed files with 6 additions and 4 deletions

View File

@@ -1370,7 +1370,7 @@ bool ImageIO::saveMetadata(const Glib::ustring &fname) const
if (has_meta) {
try {
metadataInfo.saveToImage(fname);
metadataInfo.saveToImage(fname, false);
// auto src = open_exiv2(metadataInfo.filename());
// auto dst = open_exiv2(fname);
// src->readMetadata();

View File

@@ -217,7 +217,7 @@ void Exiv2Metadata::do_merge_xmp(Exiv2::Image *dst) const
}
void Exiv2Metadata::saveToImage(const Glib::ustring &path) const
void Exiv2Metadata::saveToImage(const Glib::ustring &path, bool preserve_all_tags) const
{
auto dst = open_exiv2(path, false);
if (image_.get()) {
@@ -227,7 +227,9 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path) const
do_merge_xmp(dst.get());
}
auto srcexif = image_->exifData();
remove_unwanted(srcexif);
if (!preserve_all_tags) {
remove_unwanted(srcexif);
}
dst->setExifData(srcexif);
} else {
dst->setExifData(exif_data_);

View File

@@ -53,7 +53,7 @@ public:
void setExif(const rtengine::procparams::ExifPairs& exif);
void setIptc(const rtengine::procparams::IPTCPairs& iptc);
void saveToImage(const Glib::ustring& path) const;
void saveToImage(const Glib::ustring& path, bool preserve_all_tags) const;
void saveToXmp(const Glib::ustring& path) const;
void setExifKeys(const std::vector<std::string> *keys);