git repos / SagoImageBrowser

blame: src/exifreader.h

normal view · raw

53fdab93 Poul Sander 2026-05-18 18:45 1
#pragma once
53fdab93 Poul Sander 2026-05-18 18:45 2
80a9926d Poul Sander 2026-05-19 20:28 3
#include <QByteArray>
53fdab93 Poul Sander 2026-05-18 18:45 4
#include <QString>
53fdab93 Poul Sander 2026-05-18 18:45 5
#include <QList>
53fdab93 Poul Sander 2026-05-18 18:45 6
#include <QPair>
53fdab93 Poul Sander 2026-05-18 18:45 7
53fdab93 Poul Sander 2026-05-18 18:45 8
struct ExifData {
beb4a823 Poul Sander 2026-05-19 21:53 9
    QString captionAbstract;  // IPTC Caption-Abstract (Iptc.Application2.Caption)
beb4a823 Poul Sander 2026-05-19 21:53 10
    QString description;      // Exif.Image.ImageDescription
53fdab93 Poul Sander 2026-05-18 18:45 11
    QString dateTime;
53fdab93 Poul Sander 2026-05-18 18:45 12
    QString make;
53fdab93 Poul Sander 2026-05-18 18:45 13
    QString model;
53fdab93 Poul Sander 2026-05-18 18:45 14
    QString exposureTime;
53fdab93 Poul Sander 2026-05-18 18:45 15
    QString fNumber;
53fdab93 Poul Sander 2026-05-18 18:45 16
    QString iso;
53fdab93 Poul Sander 2026-05-18 18:45 17
    QString focalLength;
53fdab93 Poul Sander 2026-05-18 18:45 18
    QString flash;
700d6f2d Poul Sander 2026-06-06 15:44 19
    QString filename;
53fdab93 Poul Sander 2026-05-18 18:45 20
    QString dimensions;
53fdab93 Poul Sander 2026-05-18 18:45 21
    QString fileSize;
091a4f7d Poul Sander 2026-06-09 19:54 22
    QString orientation;
091a4f7d Poul Sander 2026-06-09 19:54 23
    QString latitude;
091a4f7d Poul Sander 2026-06-09 19:54 24
    QString longitude;
091a4f7d Poul Sander 2026-06-09 19:54 25
    QString osmLink;
53fdab93 Poul Sander 2026-05-18 18:45 26
53fdab93 Poul Sander 2026-05-18 18:45 27
    bool isEmpty() const;
53fdab93 Poul Sander 2026-05-18 18:45 28
    QList<QPair<QString, QString>> toList() const;
53fdab93 Poul Sander 2026-05-18 18:45 29
};
53fdab93 Poul Sander 2026-05-18 18:45 30
53fdab93 Poul Sander 2026-05-18 18:45 31
namespace ExifReader {
80a9926d Poul Sander 2026-05-19 20:28 32
ExifData read(const QByteArray &path);
beb4a823 Poul Sander 2026-05-19 21:53 33
beb4a823 Poul Sander 2026-05-19 21:53 34
// Write caption to IPTC Caption-Abstract.
beb4a823 Poul Sander 2026-05-19 21:53 35
// If oldData.captionAbstract == oldData.description they were in sync;
beb4a823 Poul Sander 2026-05-19 21:53 36
// in that case also update Exif.Image.ImageDescription to match.
beb4a823 Poul Sander 2026-05-19 21:53 37
// Returns true on success.
beb4a823 Poul Sander 2026-05-19 21:53 38
bool saveCaption(const QByteArray &path,
beb4a823 Poul Sander 2026-05-19 21:53 39
                 const QString    &caption,
beb4a823 Poul Sander 2026-05-19 21:53 40
                 const ExifData   &oldData);
48534775 Poul Sander 2026-06-08 18:57 41
48534775 Poul Sander 2026-06-08 18:57 42
// Rotate the image 90 degrees by updating the Exif.Image.Orientation tag only
48534775 Poul Sander 2026-06-08 18:57 43
// (lossless — pixel data is left untouched). clockwise=true rotates right.
48534775 Poul Sander 2026-06-08 18:57 44
// Returns true on success.
48534775 Poul Sander 2026-06-08 18:57 45
bool rotate(const QByteArray &path, bool clockwise);
53fdab93 Poul Sander 2026-05-18 18:45 46
} // namespace ExifReader
1970-01-01 00:00 47