24#include "exiv2lib_export.h"
30#include "xmp_exiv2.hpp"
64 typedef enum { kpsNone, kpsBasic, kpsXMP, kpsRecursive
65 , kpsIccProfile , kpsIptcErase
91 uint16_t supportedMetadata,
247 virtual void setMetadata(
const Image& image);
252 virtual void clearMetadata();
292 virtual std::string& xmpPacket();
307 void writeXmpFromPacket(
bool flag);
334 bool isBigEndianPlatform();
339 bool isLittleEndianPlatform();
341 bool isStringType(uint16_t
type);
342 bool isShortType(uint16_t
type);
343 bool isLongType(uint16_t
type);
344 bool isLongLongType(uint16_t
type);
345 bool isRationalType(uint16_t
type);
346 bool is2ByteType(uint16_t
type);
347 bool is4ByteType(uint16_t
type);
348 bool is8ByteType(uint16_t
type);
352 uint64_t byteSwap(uint64_t value,
bool bSwap)
const;
353 uint32_t byteSwap(uint32_t value,
bool bSwap)
const;
354 uint16_t byteSwap(uint16_t value,
bool bSwap)
const;
355 uint16_t byteSwap2(
const DataBuf& buf,
size_t offset,
bool bSwap)
const;
356 uint32_t byteSwap4(
const DataBuf& buf,
size_t offset,
bool bSwap)
const;
357 uint64_t byteSwap8(
const DataBuf& buf,
size_t offset,
bool bSwap)
const;
432 virtual std::string
comment()
const;
436 virtual const std::string&
xmpPacket()
const;
473 uint16_t supportedMetadata
476 supportedMetadata_ = supportedMetadata;
496 const std::string&
tagName(uint16_t tag);
499 const char*
typeName(uint16_t tag)
const;
512 uint16_t supportedMetadata_;
513 bool writeXmpFromPacket_;
516 std::map<int,std::string> tags_;
531 class EXIV2API ImageFactory {
549#ifdef EXV_UNICODE_PATH
570#ifdef EXV_UNICODE_PATH
617#ifdef EXV_UNICODE_PATH
654 static int getType(
const std::string& path);
655#ifdef EXV_UNICODE_PATH
660 static int getType(
const std::wstring& wpath);
669 static int getType(
const byte* data,
long size);
715 ImageFactory(
const ImageFactory& rhs);
An interface for simple binary IO.
Definition basicio.hpp:55
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition basicio.hpp:58
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:193
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition exif.hpp:434
static Image::AutoPtr open(const std::string &path, bool useCurl=true)
Create an Image subclass of the appropriate type by reading the specified file. Image type is derived...
Definition image.cpp:922
static AccessMode checkMode(int type, MetadataId metadataId)
Returns the access mode or supported metadata functions for an image type and a metadata type.
Definition image.cpp:803
static Image::AutoPtr create(int type, const std::string &path)
Create an Image subclass of the requested type by creating a new image file. If the file already exis...
Definition image.cpp:959
static int getType(const std::string &path)
Returns the image type of the provided file.
Definition image.cpp:839
static BasicIo::AutoPtr createIo(const std::string &path, bool useCurl=true)
Create the appropriate class type implemented BasicIo based on the protocol of the input.
Definition image.cpp:871
static bool checkType(int type, BasicIo &io, bool advance)
Determine if the content of io is an image of type.
Definition image.cpp:830
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:78
virtual int pixelHeight() const
Return the pixel height of the image.
Definition image.cpp:722
int pixelHeight_
image pixel height
Definition image.hpp:492
int pixelWidth_
image pixel width
Definition image.hpp:491
virtual void clearIccProfile()
Erase iccProfile. the profile is not removed from the actual image until the writeMetadata() method i...
Definition image.cpp:702
virtual void readMetadata()=0
Read all metadata supported by a specific image format from the image. Before this method is called,...
virtual void setIptcData(const IptcData &iptcData)
Assign new IPTC data. The new IPTC data is not written to the image until the writeMetadata() method ...
Definition image.cpp:641
bool supportsMetadata(MetadataId metadataId) const
Check if image supports a particular type of metadata. This method is deprecated. Use checkMode() ins...
Definition image.cpp:774
virtual std::string & xmpPacket()
Return a modifiable reference to the raw XMP packet.
Definition image.cpp:595
BasicIo::AutoPtr io_
Image data IO pointer.
Definition image.hpp:484
void setTypeSupported(int imageType, uint16_t supportedMetadata)
set type support for this image format
Definition image.hpp:471
virtual int pixelWidth() const
Return the pixel width of the image.
Definition image.cpp:717
virtual void setExifData(const ExifData &exifData)
Assign new Exif data. The new Exif data is not written to the image until the writeMetadata() method ...
Definition image.cpp:631
bool good() const
Check if the Image instance is valid. Use after object construction.
Definition image.cpp:767
virtual std::string mimeType() const =0
Return the MIME type of the image.
virtual void setXmpData(const XmpData &xmpData)
Assign new XMP data. The new XMP data is not written to the image until the writeMetadata() method is...
Definition image.cpp:667
virtual std::string comment() const
Return a copy of the image comment. May be an empty string.
Definition image.cpp:742
virtual void clearComment()
Erase any buffered comment. Comment is not removed from the actual image until the writeMetadata() me...
Definition image.cpp:682
const std::string & tagName(uint16_t tag)
Return tag name for given tag id.
Definition image.cpp:784
virtual void clearExifData()
Erase any buffered Exif data. Exif data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:626
virtual void clearXmpPacket()
Erase the buffered XMP packet. XMP data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:646
NativePreviewList nativePreviews_
list of native previews
Definition image.hpp:493
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
virtual void clearIptcData()
Erase any buffered IPTC data. IPTC data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:636
virtual void setXmpPacket(const std::string &xmpPacket)
Assign a raw XMP packet. The new XMP packet is not written to the image until the writeMetadata() met...
Definition image.cpp:652
virtual void printStructure(std::ostream &out, PrintStructureOption option=kpsNone, int depth=0)
Print out the structure of image file.
Definition image.cpp:190
AccessMode checkMode(MetadataId metadataId) const
Returns the access mode, i.e., the metadata functions, which this image supports for the metadata typ...
Definition image.cpp:779
virtual void clearXmpData()
Erase any buffered XMP data. XMP data is not removed from the actual image until the writeMetadata() ...
Definition image.cpp:661
int imageType() const
set type support for this image format
Definition image.hpp:480
ExifData exifData_
Exif data container.
Definition image.hpp:485
virtual XmpData & xmpData()
Returns an XmpData instance containing currently buffered XMP data.
Definition image.cpp:590
virtual void setIccProfile(DataBuf &iccProfile, bool bTestValid=true)
Set the image iccProfile. The new profile is not written to the image until the writeMetadata() metho...
Definition image.cpp:692
std::string xmpPacket_
XMP packet.
Definition image.hpp:490
void writeXmpFromPacket(bool flag)
Determine the source when writing XMP.
Definition image.cpp:674
virtual DataBuf * iccProfile()
return iccProfile
Definition image.hpp:240
virtual bool iccProfileDefined()
Erase iccProfile. the profile is not removed from the actual image until the writeMetadata() method i...
Definition image.hpp:235
IptcData iptcData_
IPTC data container.
Definition image.hpp:486
virtual IptcData & iptcData()
Returns an IptcData instance containing currently buffered IPTC data.
Definition image.cpp:585
virtual ExifData & exifData()
Returns an ExifData instance containing currently buffered Exif data.
Definition image.cpp:580
std::string comment_
User comment.
Definition image.hpp:489
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
const char * typeName(uint16_t tag) const
Return tag type for given tag id.
Definition image.cpp:323
virtual void setComment(const std::string &comment)
Set the image comment. The new comment is not written to the image until the writeMetadata() method i...
Definition image.cpp:687
virtual void writeMetadata()=0
Write metadata back to the image.
DataBuf iccProfile_
ICC buffer (binary data).
Definition image.hpp:488
const NativePreviewList & nativePreviews() const
Return list of native previews. This is meant to be used only by the PreviewManager.
Definition image.cpp:762
XmpData xmpData_
XMP data container.
Definition image.hpp:487
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:170
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition xmp_exiv2.hpp:166
Encoding and decoding of Exif data.
Encoding and decoding of IPTC data.
Supported image formats.
Definition asfvideo.hpp:42
const int none
Not an image.
Definition image.hpp:45
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
std::vector< byte > Blob
Container for binary data.
Definition types.hpp:151
EXIV2API void append(Exiv2::Blob &blob, const byte *buf, uint32_t len)
Append len bytes pointed to by buf to blob.
Definition image.cpp:1013
ByteOrder
Type to express the byte order (little or big endian).
Definition types.hpp:102
bool(* IsThisTypeFct)(BasicIo &iIo, bool advance)
Type for function pointer that checks image types.
Definition image.hpp:524
MetadataId
An identifier for each type of metadata.
Definition types.hpp:108
AccessMode
An identifier for each mode of metadata support.
Definition types.hpp:111
std::vector< NativePreview > NativePreviewList
List of native previews. This is meant to be used only by the PreviewManager.
Definition image.hpp:59
Image::AutoPtr(* NewInstanceFct)(BasicIo::AutoPtr io, bool create)
Type for function pointer that creates new Image instances.
Definition image.hpp:522
Native preview information. This is meant to be used only by the PreviewManager.
Definition image.hpp:49
std::string filter_
Filter.
Definition image.hpp:54
uint32_t width_
Width.
Definition image.hpp:52
uint32_t size_
Size.
Definition image.hpp:51
std::string mimeType_
MIME type.
Definition image.hpp:55
uint32_t height_
Height.
Definition image.hpp:53
long position_
Position.
Definition image.hpp:50