File indexing completed on 2024-04-28 04:32:15

0001 /*
0002     A command line tool to test XMP sidecar functionality
0003 
0004     SPDX-FileCopyrightText: 2010 Jakob Malm <jakob dot malm at gmail dot com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 // Qt includes
0010 
0011 #include <QString>
0012 #include <QFile>
0013 #include <QDebug>
0014 
0015 // Local includes
0016 
0017 #include "kexiv2.h"
0018 
0019 using namespace KExiv2Iface;
0020 
0021 int main (int argc, char **argv)
0022 {
0023     if(argc != 2)
0024     {
0025         qDebug() << "readimagewritecmpsidecar - read metadata from image and write to XMP sidecar";
0026         qDebug() << "Usage: <image>";
0027         return -1;
0028     }
0029 
0030     QString filePath = QString::fromLocal8Bit(argv[1]);
0031 
0032     KExiv2 meta;
0033 
0034     // Read metadata from the image
0035     meta.load(filePath);
0036 
0037     // Write metadata to XMP sidecar
0038     meta.setMetadataWritingMode(KExiv2::WRITETOSIDECARONLY);
0039     meta.save(filePath);
0040 
0041     return 0;
0042 }