metadata: make sure to include XResolution and YResolution when writing TIFFs

This is mandatory (according to http://dpfmanager.org), and in fact needed for
Photoshop compatibility

(cherry picked from commit 5d281810cc7a7f7dc563dde030cf90c78dbf55d0)
This commit is contained in:
Alberto Griggio
2021-01-27 10:06:25 -08:00
committed by Lawrence Lee
parent 939315f67b
commit 522f6f4473
3 changed files with 66 additions and 2 deletions

View File

@@ -390,7 +390,12 @@ void Exiv2Metadata::import_exif_pairs(Exiv2::ExifData &out) const
for (auto &p : *exif_) {
try {
out[p.first] = p.second;
} catch (std::exception &exc) {}
} catch (std::exception &exc) {
if (settings->verbose) {
std::cout << "Error setting " << p.first << " to " << p.second
<< ": " << exc.what() << std::endl;
}
}
}
}
@@ -408,7 +413,12 @@ void Exiv2Metadata::import_iptc_pairs(Exiv2::IptcData &out) const
out.add(d);
}
}
} catch (std::exception &exc) {}
} catch (std::exception &exc) {
if (settings->verbose) {
std::cout << "Error setting " << p.first
<< ": " << exc.what() << std::endl;
}
}
}
}
@@ -515,4 +525,30 @@ void Exiv2Metadata::cleanup()
Exiv2::XmpParser::terminate();
}
Exiv2::ExifData Exiv2Metadata::getOutputExifData() const
{
Exiv2::ExifData exif = exifData();
try {
auto xmp = getXmpSidecar(src_);
Exiv2::moveXmpToExif(xmp, exif);
} catch (std::exception &exc) {
if (settings->verbose) {
std::cerr << "Error loading metadata from XMP sidecar: "
<< exc.what() << std::endl;
}
}
remove_unwanted(exif);
import_exif_pairs(exif);
for (auto it = exif.begin(); it != exif.end(); ) {
if (it->count() > 0) {
++it;
} else {
it = exif.erase(it);
}
}
return exif;
}
} // namespace rtengine