Sample program showing how to set the Exif comment of an image.
#include <iostream>
#include <cassert>
int main(int argc, char* const argv[])
try {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " file\n";
return 1;
}
assert (image.get() != 0);
image->readMetadata();
exifData["Exif.Photo.UserComment"]
= "charset=\"Unicode\" An Unicode Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "charset=\"Undefined\" An undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "Another undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "charset=Ascii An ASCII Exif comment added with Exiv2";
std::cout << "Writing user comment '"
<< exifData["Exif.Photo.UserComment"]
<< "' back to the image\n";
image->writeMetadata();
return 0;
}
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return -1;
}