Merge pull request #7046 from blitzgneisserin/patch-5

Add correct DateTime (editing date) to Exif data
This commit is contained in:
Lawrence37 2024-05-27 11:13:54 -07:00 committed by GitHub
commit f2c613c8f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,7 @@
#include "imagedata.h"
#include "../rtgui/version.h"
#include "../rtgui/pathutils.h"
#include <ctime>
#if EXIV2_TEST_VERSION(0,28,0)
@ -299,6 +300,13 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path, bool preserve_all_tag
}
dst->exifData()["Exif.Image.Software"] = "RawTherapee " RTVERSION;
std::time_t t = std::time(nullptr);
char mbstr[20];
if (std::strftime(mbstr, sizeof(mbstr), "%Y:%m:%d %H:%M:%S", std::localtime(&t))) {
dst->exifData()["Exif.Image.DateTime"] = mbstr;
}
import_exif_pairs(dst->exifData());
import_iptc_pairs(dst->iptcData());
bool xmp_tried = false;