metadata: erase also jpeg thumbnail
(cherry picked from commit 88661755506cd48393e69e809cf0559572cb213d)
This commit is contained in:
parent
2d412d7404
commit
77d7e633e5
@ -187,11 +187,7 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path) const
|
||||
dst->readMetadata();
|
||||
if (image_.get()) {
|
||||
dst->setMetadata(*image_);
|
||||
auto it =
|
||||
dst->exifData().findKey(Exiv2::ExifKey("Exif.Image.Orientation"));
|
||||
if (it != dst->exifData().end()) {
|
||||
dst->exifData().erase(it);
|
||||
}
|
||||
remove_unwanted(dst.get());
|
||||
if (merge_xmp_) {
|
||||
do_merge_xmp(dst.get());
|
||||
}
|
||||
@ -208,6 +204,23 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path) const
|
||||
}
|
||||
|
||||
|
||||
void Exiv2Metadata::remove_unwanted(Exiv2::Image *dst) const
|
||||
{
|
||||
static const std::vector<std::string> keys = {
|
||||
"Exif.Image.Orientation",
|
||||
"Exif.Photo.MakerNote"
|
||||
};
|
||||
for (auto &k : keys) {
|
||||
auto it = dst->exifData().findKey(Exiv2::ExifKey(k));
|
||||
if (it != dst->exifData().end()) {
|
||||
dst->exifData().erase(it);
|
||||
}
|
||||
}
|
||||
Exiv2::ExifThumb thumb(dst->exifData());
|
||||
thumb.erase();
|
||||
}
|
||||
|
||||
|
||||
void Exiv2Metadata::import_exif_pairs(Exiv2::ExifData &out) const
|
||||
{
|
||||
for (auto &p : *exif_) {
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
void do_merge_xmp(Exiv2::Image* dst) const;
|
||||
void import_exif_pairs(Exiv2::ExifData& out) const;
|
||||
void import_iptc_pairs(Exiv2::IptcData& out) const;
|
||||
void remove_unwanted(Exiv2::Image* dst) const;
|
||||
|
||||
Glib::ustring src_;
|
||||
bool merge_xmp_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user