MauiKit Image Tools

exiv2extractor.h
1// SPDX-License-Identifier: LGPL-3.0-or-later
2
3/*
4 Copyright (C) 2012-15 Vishesh Handa <vhanda@kde.org>
5
6This library is free software; you can redistribute it and/or
7modify it under the terms of the GNU Lesser General Public
8License as published by the Free Software Foundation; either
9version 2.1 of the License, or (at your option) any later version.
10
11This library is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public
17License along with this library; if not, write to the Free Software
18Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*/
20
21#pragma once
22
23#include <QString>
24#include <QVariant>
25#include <QUrl>
26#include <QSize>
27
28#include "imagetools_export.h"
29
30typedef QMap<QString, QString> MetaDataMap;
31struct Coordinates
32{
33 double altitude;
34 double latitude;
35 double longitude;
36};
37
38namespace KExiv2Iface
39{
40class KExiv2;
41}
42class City;
43
44/**
45 * @brief Image metadata extractor.
46 */
47class IMAGETOOLS_EXPORT Exiv2Extractor : public QObject
48{
49public:
50 Exiv2Extractor(const QUrl &url, QObject * parent = nullptr);
51 explicit Exiv2Extractor(QObject * parent = nullptr);
52
53 ~Exiv2Extractor();
54
55 void setUrl(const QUrl &url);
56
57 Coordinates extractGPS() const;
58
59 bool error() const;
60
61 QString getExifTagString (const char *exifTagName, bool escapeCR=true) const;
62 QByteArray getExifTagData (const char *exifTagName) const;
63 QVariant getExifTagVariant (const char *exifTagName, bool rationalAsListOfInts=true, bool escapeCR=true, int component=0) const;
64 MetaDataMap getExifTagsDataList( const QStringList & exifKeysFilter = QStringList(), bool invertSelection = false ) const;
65
66 bool writeTag(const char *tagName, const QVariant &value);
67 bool removeTag(const char *tagName);
68
69 bool setComment(const QString &comment);
70 QString getComments() const;
71 QString getExifComment() const;
72 bool removeComment() const;
73
74 QString GPSString() const;
75 QString cityId() const;
76 City city() const;
77
78 QSize getPixelSize();
79 bool applyChanges();
80
81 bool setGpsData(const double latitude, const double longitude, const double altitude = 0.0);
82 bool removeGpsData();
83
84 bool clearData();
85
86private:
87
88 bool m_error;
89
90 QUrl m_url;
91 QString m_mimetype;
92 KExiv2Iface::KExiv2 *m_exiv2;
93};
A class for representing the GPS coordinates and information of a city.
QObject(QObject *parent)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 11 2025 11:57:09 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.