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;
53fdab93 Poul Sander 2026-05-18 18:45 22
53fdab93 Poul Sander 2026-05-18 18:45 23
    bool isEmpty() const;
53fdab93 Poul Sander 2026-05-18 18:45 24
    QList<QPair<QString, QString>> toList() const;
53fdab93 Poul Sander 2026-05-18 18:45 25
};
53fdab93 Poul Sander 2026-05-18 18:45 26
53fdab93 Poul Sander 2026-05-18 18:45 27
namespace ExifReader {
80a9926d Poul Sander 2026-05-19 20:28 28
ExifData read(const QByteArray &path);
beb4a823 Poul Sander 2026-05-19 21:53 29
beb4a823 Poul Sander 2026-05-19 21:53 30
// Write caption to IPTC Caption-Abstract.
beb4a823 Poul Sander 2026-05-19 21:53 31
// If oldData.captionAbstract == oldData.description they were in sync;
beb4a823 Poul Sander 2026-05-19 21:53 32
// in that case also update Exif.Image.ImageDescription to match.
beb4a823 Poul Sander 2026-05-19 21:53 33
// Returns true on success.
beb4a823 Poul Sander 2026-05-19 21:53 34
bool saveCaption(const QByteArray &path,
beb4a823 Poul Sander 2026-05-19 21:53 35
                 const QString    &caption,
beb4a823 Poul Sander 2026-05-19 21:53 36
                 const ExifData   &oldData);
48534775 Poul Sander 2026-06-08 18:57 37
48534775 Poul Sander 2026-06-08 18:57 38
// Rotate the image 90 degrees by updating the Exif.Image.Orientation tag only
48534775 Poul Sander 2026-06-08 18:57 39
// (lossless — pixel data is left untouched). clockwise=true rotates right.
48534775 Poul Sander 2026-06-08 18:57 40
// Returns true on success.
48534775 Poul Sander 2026-06-08 18:57 41
bool rotate(const QByteArray &path, bool clockwise);
53fdab93 Poul Sander 2026-05-18 18:45 42
} // namespace ExifReader
1970-01-01 00:00 43