Exiv2
tiffimage.hpp
1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2021 Exiv2 authors
4 * This program is part of the Exiv2 distribution.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef TIFFIMAGE_HPP_
22#define TIFFIMAGE_HPP_
23
24// *****************************************************************************
25#include "exiv2lib_export.h"
26
27// included header files
28#include "image.hpp"
29
30// *****************************************************************************
31// namespace extensions
32namespace Exiv2 {
33
34// *****************************************************************************
35// class definitions
36
37 // Add TIFF to the supported image formats
38 namespace ImageType {
39 const int tiff = 4;
40 const int dng = 4;
41 const int nef = 4;
42 const int pef = 4;
43 const int arw = 4;
44 const int sr2 = 4;
45 const int srw = 4;
46 }
47
52 class EXIV2API TiffImage : public Image {
53 public:
55
56
71 TiffImage(BasicIo::UniquePtr io, bool create);
73
75
76 void readMetadata() override;
77 void writeMetadata() override;
78
85 void printStructure(std::ostream& out, PrintStructureOption option, int depth = 0) override;
86
91 void setComment(const std::string& comment) override;
93
95
96 std::string mimeType() const override;
97 int pixelWidth() const override;
98 int pixelHeight() const override;
100
102
103
104 TiffImage(const TiffImage& rhs) = delete;
106 TiffImage& operator=(const TiffImage& rhs) = delete;
108
109 private:
111
112
113 std::string primaryGroup() const;
115
116 // DATA
117 mutable std::string primaryGroup_;
118 mutable std::string mimeType_;
119 mutable int pixelWidthPrimary_;
120 mutable int pixelHeightPrimary_;
121
122 }; // class TiffImage
123
129 class EXIV2API TiffParser {
130 public:
144 static ByteOrder decode(
145 ExifData& exifData,
146 IptcData& iptcData,
147 XmpData& xmpData,
148 const byte* pData,
149 uint32_t size
150 );
184 static WriteMethod encode(
185 BasicIo& io,
186 const byte* pData,
187 uint32_t size,
188 ByteOrder byteOrder,
189 const ExifData& exifData,
190 const IptcData& iptcData,
191 const XmpData& xmpData
192 );
193
194 }; // class TiffParser
195
196// *****************************************************************************
197// template, inline and free functions
198
199 // These could be static private functions on Image subclasses but then
200 // ImageFactory needs to be made a friend.
206 EXIV2API Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create);
207
209 EXIV2API bool isTiffType(BasicIo& iIo, bool advance);
210
211} // namespace Exiv2
212
213#endif // #ifndef TIFFIMAGE_HPP_
An interface for simple binary IO.
Definition: basicio.hpp:55
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition: image.hpp:81
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:169
Class to access TIFF images. Exif metadata is supported directly, IPTC is read from the Exif data,...
Definition: tiffimage.hpp:52
TiffImage(const TiffImage &rhs)=delete
Copy constructor.
TiffImage & operator=(const TiffImage &rhs)=delete
Assignment operator.
Stateless parser class for data in TIFF format. Images use this class to decode and encode TIFF data....
Definition: tiffimage.hpp:129
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition: xmp_exiv2.hpp:165
const int pef
PEF image type (see class TiffImage)
Definition: tiffimage.hpp:42
const int nef
NEF image type (see class TiffImage)
Definition: tiffimage.hpp:41
const int dng
DNG image type (see class TiffImage)
Definition: tiffimage.hpp:40
const int sr2
SR2 image type (see class TiffImage)
Definition: tiffimage.hpp:44
const int srw
SRW image type (see class TiffImage)
Definition: tiffimage.hpp:45
const int arw
ARW image type (see class TiffImage)
Definition: tiffimage.hpp:43
const int tiff
TIFF image type (see class TiffImage)
Definition: tiffimage.hpp:39
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: basicio.hpp:43
EXIV2API Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create)
Create a new TiffImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition: tiffimage.cpp:308
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:120
EXIV2API bool isTiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a TIFF image.
Definition: tiffimage.cpp:317
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:83
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition: types.hpp:86