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
32 namespace 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  TiffImage(const TiffImage& rhs);
107  TiffImage& operator=(const TiffImage& rhs);
109 
111 
112  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
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
std::auto_ptr< Image > AutoPtr
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:170
Class to access TIFF images. Exif metadata is supported directly, IPTC is read from the Exif data,...
Definition: tiffimage.hpp:52
Stateless parser class for data in TIFF format. Images use this class to decode and encode TIFF data....
Definition: tiffimage.hpp:130
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition: xmp_exiv2.hpp:166
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
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:139
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