7#include "exiv2lib_export.h"
12#include "image_types.hpp"
14#include "xmp_exiv2.hpp"
219 virtual void setMetadata(
const Image& image);
224 virtual void clearMetadata();
264 virtual std::string& xmpPacket();
279 void writeXmpFromPacket(
bool flag);
302 char c,
size_t depth);
307 static bool isBigEndianPlatform();
312 static bool isLittleEndianPlatform();
314 static bool isStringType(uint16_t type);
315 static bool isShortType(uint16_t type);
316 static bool isLongType(uint16_t type);
317 static bool isLongLongType(uint16_t type);
318 static bool isRationalType(uint16_t type);
319 static bool is2ByteType(uint16_t type);
320 static bool is4ByteType(uint16_t type);
321 static bool is8ByteType(uint16_t type);
325 static uint64_t byteSwap(uint64_t value,
bool bSwap);
326 static uint32_t byteSwap(uint32_t value,
bool bSwap);
327 static uint16_t byteSwap(uint16_t value,
bool bSwap);
328 static uint16_t byteSwap2(
const DataBuf& buf,
size_t offset,
bool bSwap);
329 static uint32_t byteSwap4(
const DataBuf& buf,
size_t offset,
bool bSwap);
330 static uint64_t byteSwap8(
const DataBuf& buf,
size_t offset,
bool bSwap);
340 [[nodiscard]]
ByteOrder byteOrder()
const;
345 [[nodiscard]]
bool good()
const;
356 [[nodiscard]]
virtual std::string
mimeType()
const = 0;
360 [[nodiscard]]
virtual uint32_t
pixelWidth()
const;
364 [[nodiscard]]
virtual uint32_t
pixelHeight()
const;
404 [[nodiscard]]
virtual std::string
comment()
const;
408 [[nodiscard]]
virtual const std::string&
xmpPacket()
const;
423 [[nodiscard]]
virtual BasicIo&
io()
const;
445 supportedMetadata_ = supportedMetadata;
475 const std::string&
tagName(uint16_t tag);
478 static const char*
typeName(uint16_t tag);
483 uint16_t supportedMetadata_;
484#ifdef EXV_HAVE_XMP_TOOLKIT
485 bool writeXmpFromPacket_{
false};
487 bool writeXmpFromPacket_{
true};
489 ByteOrder byteOrder_{invalidByteOrder};
491 std::map<int, std::string> tags_;
An interface for simple binary IO.
Definition basicio.hpp:35
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition basicio.hpp:38
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition exif.hpp:379
Returns an Image instance of the specified type.
Definition image.hpp:506
static bool checkType(ImageType type, BasicIo &io, bool advance)
Determine if the content of io is an image of type.
Definition image.cpp:747
static Image::UniquePtr 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:804
static AccessMode checkMode(ImageType type, MetadataId metadataId)
Returns the access mode or supported metadata functions for an image type and a metadata type.
Definition image.cpp:732
static BasicIo::UniquePtr 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:779
static Image::UniquePtr create(ImageType 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:831
static ImageType getType(const std::string &path)
Returns the image type of the provided file.
Definition image.cpp:753
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
ImageType imageType() const
set type support for this image format
Definition image.hpp:449
static const char * typeName(uint16_t tag)
Return tag type for given tag id.
Definition image.cpp:240
virtual void clearIccProfile()
Erase iccProfile. the profile is not removed from the actual image until the writeMetadata() method i...
Definition image.cpp:640
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:584
Image & operator=(const Image &)=delete
Assignment operator.
bool supportsMetadata(MetadataId metadataId) const
Check if image supports a particular type of metadata. This method is deprecated. Use checkMode() ins...
Definition image.cpp:700
virtual std::string & xmpPacket()
Return a modifiable reference to the raw XMP packet.
Definition image.cpp:544
Image(ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io)
Constructor taking the image type, a bitmap of the supported metadata types and an auto-pointer that ...
Definition image.cpp:132
virtual uint32_t pixelHeight() const
Return the pixel height of the image.
Definition image.cpp:656
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:576
virtual uint32_t pixelWidth() const
Return the pixel width of the image.
Definition image.cpp:652
bool good() const
Check if the Image instance is valid. Use after object construction.
Definition image.cpp:692
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:605
virtual std::string comment() const
Return a copy of the image comment. May be an empty string.
Definition image.cpp:672
virtual void clearComment()
Erase any buffered comment. Comment is not removed from the actual image until the writeMetadata() me...
Definition image.cpp:619
const std::string & tagName(uint16_t tag)
Return tag name for given tag id.
Definition image.cpp:708
virtual void clearExifData()
Erase any buffered Exif data. Exif data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:572
virtual void printStructure(std::ostream &out, PrintStructureOption option=kpsNone, size_t depth=0)
Print out the structure of image file.
Definition image.cpp:136
BasicIo::UniquePtr io_
Image data IO pointer.
Definition image.hpp:463
virtual const DataBuf & iccProfile() const
return iccProfile
Definition image.hpp:209
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:627
virtual void clearXmpPacket()
Erase the buffered XMP packet. XMP data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:588
NativePreviewList nativePreviews_
list of native previews
Definition image.hpp:472
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition image.cpp:680
virtual void clearIptcData()
Erase any buffered IPTC data. IPTC data is not removed from the actual image until the writeMetadata(...
Definition image.cpp:580
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:593
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:704
virtual void clearXmpData()
Erase any buffered XMP data. XMP data is not removed from the actual image until the writeMetadata() ...
Definition image.cpp:600
virtual ~Image()=default
Virtual Destructor.
ExifData exifData_
Exif data container.
Definition image.hpp:464
virtual XmpData & xmpData()
Returns an XmpData instance containing currently buffered XMP data.
Definition image.cpp:540
std::string xmpPacket_
XMP packet.
Definition image.hpp:469
void writeXmpFromPacket(bool flag)
Determine the source when writing XMP.
Definition image.cpp:611
virtual bool iccProfileDefined()
Returns the status of the ICC profile in the image instance.
Definition image.hpp:202
Image(const Image &)=delete
Copy constructor.
IptcData iptcData_
IPTC data container.
Definition image.hpp:465
virtual IptcData & iptcData()
Returns an IptcData instance containing currently buffered IPTC data.
Definition image.cpp:536
virtual ExifData & exifData()
Returns an ExifData instance containing currently buffered Exif data.
Definition image.cpp:532
uint32_t pixelHeight_
image pixel height
Definition image.hpp:471
void setTypeSupported(ImageType imageType, uint16_t supportedMetadata)
set type support for this image format
Definition image.hpp:443
std::string comment_
User comment.
Definition image.hpp:468
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition image.hpp:53
uint32_t pixelWidth_
image pixel width
Definition image.hpp:470
virtual void setComment(const std::string &comment)
Set the image comment. The comment is written to the image when writeMetadata() is called.
Definition image.cpp:623
virtual void writeMetadata()=0
Write metadata back to the image.
DataBuf iccProfile_
ICC buffer (binary data)
Definition image.hpp:467
const NativePreviewList & nativePreviews() const
Return list of native previews. This is meant to be used only by the PreviewManager.
Definition image.cpp:688
XmpData xmpData_
XMP data container.
Definition image.hpp:466
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:153
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition xmp_exiv2.hpp:138
Encoding and decoding of Exif data.
Encoding and decoding of IPTC data.
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
PrintStructureOption
Options for printStructure.
Definition image.hpp:38
Image::UniquePtr(*)(BasicIo::UniquePtr io, bool create) NewInstanceFct
Type for function pointer that creates new Image instances.
Definition image.hpp:497
EXIV2API void append(Exiv2::Blob &blob, const byte *buf, size_t len)
Append len bytes pointed to by buf to blob.
Definition image.cpp:866
ByteOrder
Type to express the byte order (little or big endian)
Definition types.hpp:34
bool(*)(BasicIo &iIo, bool advance) IsThisTypeFct
Type for function pointer that checks image types.
Definition image.hpp:499
ImageType
Supported Image Formats.
Definition image_types.hpp:8
std::vector< NativePreview > NativePreviewList
List of native previews. This is meant to be used only by the PreviewManager.
Definition image.hpp:33
MetadataId
An identifier for each type of metadata.
Definition types.hpp:47
std::vector< byte > Blob
Container for binary data.
Definition types.hpp:102
AccessMode
An identifier for each mode of metadata support.
Definition types.hpp:57
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Native preview information. This is meant to be used only by the PreviewManager.
Definition image.hpp:23
std::string filter_
Filter.
Definition image.hpp:28
size_t height_
Height.
Definition image.hpp:27
size_t position_
Position.
Definition image.hpp:24
size_t width_
Width.
Definition image.hpp:26
std::string mimeType_
MIME type.
Definition image.hpp:29
size_t size_
Size.
Definition image.hpp:25