Exiv2
Loading...
Searching...
No Matches
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::AutoPtr io, bool create);
73
75
76 void readMetadata();
77 void writeMetadata();
78
85 virtual void printStructure(std::ostream& out, PrintStructureOption option,int depth=0);
86
91 void setComment(const std::string& comment);
93
95
96 std::string mimeType() const;
97 int pixelWidth() const;
98 int pixelHeight() const;
100
101 private:
103
104
105 TiffImage(const TiffImage& rhs);
107 TiffImage& operator=(const TiffImage& rhs);
109
111
112
113 std::string primaryGroup() const;
115
116 private:
117 // DATA
118 mutable std::string primaryGroup_;
119 mutable std::string mimeType_;
120 mutable int pixelWidth_;
121 mutable int pixelHeight_;
122
123 }; // class TiffImage
124
130 class EXIV2API TiffParser {
131 public:
145 static ByteOrder decode(
146 ExifData& exifData,
147 IptcData& iptcData,
148 XmpData& xmpData,
149 const byte* pData,
150 uint32_t size
151 );
185 static WriteMethod encode(
186 BasicIo& io,
187 const byte* pData,
188 uint32_t size,
189 ByteOrder byteOrder,
190 const ExifData& exifData,
191 const IptcData& iptcData,
192 const XmpData& xmpData
193 );
194
195 }; // class TiffParser
196
197// *****************************************************************************
198// template, inline and free functions
199
200 // These could be static private functions on Image subclasses but then
201 // ImageFactory needs to be made a friend.
207 EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create);
208
210 EXIV2API bool isTiffType(BasicIo& iIo, bool advance);
211
212} // namespace Exiv2
213
214#endif // #ifndef TIFFIMAGE_HPP_
An interface for simple binary IO.
Definition basicio.hpp:55
std::auto_ptr< BasicIo > AutoPtr
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
virtual std::string comment() const
Return a copy of the image comment. May be an empty string.
Definition image.cpp:742
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition image.hpp:81
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition image.cpp:752
Image(int imageType, uint16_t supportedMetadata, BasicIo::AutoPtr io)
Constructor taking the image type, a bitmap of the supported metadata types and an auto-pointer that ...
Definition image.cpp:167
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:170
int pixelWidth() const
Return the pixel width of the image.
Definition tiffimage.cpp:136
void writeMetadata()
Write metadata back to the image.
Definition tiffimage.cpp:205
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
Definition tiffimage.cpp:166
void setComment(const std::string &comment)
Not supported. TIFF format does not contain a comment. Calling this function will throw an Error(kerI...
Definition tiffimage.cpp:160
TiffImage(BasicIo::AutoPtr io, bool create)
Constructor that can either open an existing TIFF image or create a new image from scratch....
Definition tiffimage.cpp:70
virtual void printStructure(std::ostream &out, PrintStructureOption option, int depth=0)
Print out the structure of image file.
Definition tiffimage.cpp:342
int pixelHeight() const
Return the pixel height of the image.
Definition tiffimage.cpp:148
std::string mimeType() const
Return the MIME type of the image.
Definition tiffimage.cpp:91
Stateless parser class for data in TIFF format. Images use this class to decode and encode TIFF data....
Definition tiffimage.hpp:130
static WriteMethod encode(BasicIo &io, const byte *pData, uint32_t size, ByteOrder byteOrder, const ExifData &exifData, const IptcData &iptcData, const XmpData &xmpData)
Encode metadata from the provided metadata to TIFF format.
Definition tiffimage.cpp:275
static ByteOrder decode(ExifData &exifData, IptcData &iptcData, XmpData &xmpData, const byte *pData, uint32_t size)
Decode metadata from a buffer pData of length size with data in TIFF format to the provided metadata ...
Definition tiffimage.cpp:248
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition xmp_exiv2.hpp:166
Supported image formats.
Definition asfvideo.hpp:42
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 asfvideo.hpp:36
PrintStructureOption
Options for printStructure.
Definition image.hpp:64
EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create)
Create a new TiffImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition tiffimage.cpp:317
EXIV2API bool isTiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a TIFF image.
Definition tiffimage.cpp:326
ByteOrder
Type to express the byte order (little or big endian).
Definition types.hpp:102
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition types.hpp:105