Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <exiv2/exiv2.hpp>
- #include <iomanip>
- #include <cassert>
- int main(int argc, char const *argv[])
- try
- {
- if (argc != 2)
- {
- std::cout << "Usage: "<< argv[0] << "file\n";
- return 1;
- }
- std::string file(argv[1]);
- Exiv2::ExifData exifData;
- // General Camera Info //
- exifData["Exif.Image.Model"] = "Manta G917L";
- exifData["Exif.Image.Make"] = "Allied Vision";
- // GPS Tag Info //
- exifData["Exif.GPSInfo.GPSVersionID"] = "2 2 2 2"; // Byte
- exifData["Exif.GPSInfo.GPSLatitudeRef"] = "N"; // Ascii
- exifData["Exif.GPSInfo.GPSLatitude"] = "24/1 24/1 24/1"; // Rational
- exifData["Exif.GPSInfo.GPSLongitudeRef"] = "E"; // Ascii
- exifData["Exif.GPSInfo.GPSLongitude"] = "243/1 24/1 24/1"; // Rational
- exifData["Exif.GPSInfo.GPSAltitudeRef"] = "1"; // Byte
- exifData["Exif.GPSInfo.GPSAltitude"] = "23/1"; // Rational
- exifData["Exif.GPSInfo.GPSDateStamp"] = "2016:11:11"; // Ascii
- exifData["Exif.GPSInfo.GPSTimeStamp"] = "23/1 45/1 44/1"; // Rational
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
- assert(image.get() != 0);
- image->setExifData(exifData);
- image->writeMetadata();
- return 0;
- }
- catch(Exiv2::AnyError& e)
- {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement