Sample program showing how to set the Exif comment of an image.
#include <exiv2/exiv2.hpp>
#include <iostream>
int main(int argc, char* const argv[]) {
try {
#ifdef EXV_ENABLE_BMFF
Exiv2::enableBMFF();
#endif
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " file\n";
return EXIT_FAILURE;
}
image->readMetadata();
exifData["Exif.Photo.UserComment"] = "charset=Unicode A 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 EXIT_SUCCESS;
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return EXIT_FAILURE;
}
}
static Image::UniquePtr open(const std::string &path, bool useCurl=true)
Create an Image subclass of the appropriate type by reading the specified file. Image type is derived...