Sample program showing how to set the Exif comment of an image.
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <cassert>
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 1;
}
assert (image.get() != 0);
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 0;
}
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return -1;
}
static Image::AutoPtr 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...