File indexing completed on 2024-04-21 15:22:27

0001 /*
0002     A command line tool to tag from photo
0003 
0004     SPDX-FileCopyrightText: 2009-2012 Gilles Caulier <caulier dot gilles 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() << "erasetag - erase tag from from image";
0026         qDebug() << "Usage: <image>";
0027         return -1;
0028     }
0029 
0030     QString filePath = QString::fromLocal8Bit(argv[1]);
0031 
0032     KExiv2 meta;
0033     meta.load(filePath);
0034     meta.setWriteRawFiles(true);
0035     bool b = meta.removeExifTag("Exif.OlympusIp.BlackLevel", false);
0036     qDebug() << "Exif.OlympusIp.BlackLevel found = " << b;
0037 
0038     QByteArray ba = meta.getExifTagData("Exif.OlympusIp.BlackLevel");
0039     qDebug() << "Exif.OlympusIp.BlackLevel removed = " << ba.isEmpty();
0040 
0041     if (b)
0042     {
0043         meta.applyChanges();
0044     }
0045 
0046     return 0;
0047 }