KExiv2

kexiv2previews.h
1/*
2 SPDX-FileCopyrightText: 2009-2015 Gilles Caulier <caulier dot gilles at gmail dot com>
3 SPDX-FileCopyrightText: 2009-2012 Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#ifndef KEXIV2PREVIEWS
9#define KEXIV2PREVIEWS
10
11// Std
12
13#include <memory>
14
15// Qt includes
16
17#include <QByteArray>
18#include <QSize>
19#include <QString>
20
21// Local includes
22
23#include "libkexiv2_export.h"
24
25class QImage;
26
27namespace KExiv2Iface
28{
29
30/**
31 * @class KExiv2Previews kexiv2previews.h <KExiv2/KExiv2Previews>
32 *
33 * KExiv2Previews
34 */
35class LIBKEXIV2_EXPORT KExiv2Previews
36{
37public:
38
39 /**
40 * Open the given file and scan for embedded preview images
41 */
42 KExiv2Previews(const QString& filePath);
43
44 /**
45 * Open the given image data and scan the image for embedded preview images.
46 */
47 KExiv2Previews(const QByteArray& imgData);
49
50 /// Returns the pixel size of the original image, as read from the file (not the metadata).
51 QSize originalSize() const;
52
53 /// Returns the mimeType of the original image, detected from the file's content.
54 QString originalMimeType() const;
55
56 /// Returns if there are any preview images available
57 bool isEmpty();
58
59 /// Returns how many embedded previews are available
60 int count();
61 int size() { return count(); }
62
63 /**
64 * For each contained preview image, return the size
65 * of the image data in bytes, width and height of the preview,
66 * the mimeType and the file extension.
67 * Ensure that index < count().
68 * Previews are sorted by width*height, largest first.
69 */
70 int dataSize(int index = 0);
71 int width(int index = 0);
72 int height(int index = 0);
73 QString mimeType(int index = 0);
74 QString fileExtension(int index = 0);
75
76 /**
77 * Retrieve the image data for the specified embedded preview image
78 */
79 QByteArray data(int index = 0);
80
81 /**
82 * Loads the data of the specified preview and creates a QImage
83 * from this data. Returns a null QImage if the loading failed.
84 */
85 QImage image(int index = 0);
86
87private:
88 std::unique_ptr<class KExiv2PreviewsPrivate> const d;
89};
90
91} // namespace KExiv2Iface
92
93#endif // KEXIV2PREVIEWS
KExiv2Iface - Exiv2 library interface.
Definition kexiv2.cpp:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.