 |
Exiv2
|
25 #include "exiv2lib_export.h"
49 static const char ps3Id_[];
50 static const char* irbId_[];
51 static const char bimId_[];
63 static bool isIrb(
const byte* pPsData,
73 static bool valid(
const byte* pPsData,
92 static int locateIrb(
const byte *pPsData,
96 uint32_t *
const sizeHdr,
97 uint32_t *
const sizeData);
101 static int locateIptcIrb(
const byte *pPsData,
104 uint32_t *
const sizeHdr,
105 uint32_t *
const sizeData);
109 static int locatePreviewIrb(
const byte *pPsData,
112 uint32_t *
const sizeHdr,
113 uint32_t *
const sizeData);
123 static DataBuf setIptcIrb(
const byte* pPsData,
137 void writeMetadata();
172 const byte initData[],
197 virtual bool isThisType(
BasicIo& iIo,
bool advance)
const =0;
208 virtual int writeHeader(
BasicIo& oIo)
const =0;
235 static const char exifId_[];
236 static const char jfifId_[];
237 static const char xmpId_[];
238 static const char iccId_[];
260 int initImage(
const byte initData[],
long dataSize);
268 void doWriteMetadata(
BasicIo& oIo);
281 int advanceToMarker()
const;
313 std::string mimeType()
const;
319 bool isThisType(
BasicIo& iIo,
bool advance)
const;
331 int writeHeader(
BasicIo& oIo)
const;
336 static const byte soi_;
337 static const byte blank_[];
374 std::string mimeType()
const;
380 bool isThisType(
BasicIo& iIo,
bool advance)
const;
384 int writeHeader(
BasicIo& oIo)
const;
389 static const char exiv2Id_[];
390 static const byte blank_[];
426 #endif // #ifndef JPGIMAGE_HPP_
static const byte com_
JPEG Comment marker.
Definition: jpgimage.hpp:221
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write impleme...
Definition: basicio.hpp:540
void clear()
Delete all Exifdatum instances resulting in an empty container. Note that this also removes thumbnail...
Definition: exif.cpp:611
static const uint16_t preview_
Photoshop preview marker
Definition: jpgimage.hpp:53
friend EXIV2API bool isJpegType(BasicIo &iIo, bool advance)
Check if the file iIo is a JPEG image.
Definition: jpgimage.cpp:1354
static const byte sof3_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:225
std::string xmpPacket_
XMP packet.
Definition: image.hpp:490
virtual bool isopen() const =0
Returns true if the IO source is open, otherwise false.
const int exv
EXV image type (see class ExvImage)
Definition: jpgimage.hpp:40
virtual int error() const =0
Returns 0 if the IO source is in a valid state, otherwise nonzero.
byte * pData_
Pointer to the buffer, 0 if none has been allocated.
Definition: types.hpp:258
IptcData iptcData_
IPTC data container.
Definition: image.hpp:486
static const byte dht_
JPEG DHT marker.
Definition: jpgimage.hpp:212
static const byte dqt_
JPEG DQT marker.
Definition: jpgimage.hpp:213
void writeMetadata()
Write metadata back to the image.
Definition: jpgimage.cpp:872
Utility class that closes a BasicIo instance upon destruction. Meant to be used as a stack variable i...
Definition: basicio.hpp:264
Position
Seek starting positions.
Definition: basicio.hpp:61
static int locateIrb(const byte *pPsData, long sizePsData, uint16_t psTag, const byte **record, uint32_t *const sizeHdr, uint32_t *const sizeData)
Locates the data for a Photoshop tag in a Photoshop formated memory buffer. Operates on raw data to s...
Definition: jpgimage.cpp:152
virtual bool isThisType(BasicIo &iIo, bool advance) const =0
Determine if the content of the BasicIo instance is of the type supported by this class.
static const byte app2_
JPEG APP2 marker.
Definition: jpgimage.hpp:219
static const byte app13_
JPEG APP13 marker.
Definition: jpgimage.hpp:220
static const byte sof0_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:222
@ omitAllFormatting
Omit all formatting whitespace.
Definition: xmp_exiv2.hpp:278
std::string comment_
User comment.
Definition: image.hpp:489
static int decode(IptcData &iptcData, const byte *pData, uint32_t size)
Decode binary IPTC data in IPTC IIM4 format from a buffer pData of length size to the provided metada...
Definition: iptc.cpp:433
static const byte app0_
JPEG APP0 marker.
Definition: jpgimage.hpp:217
static int locateIptcIrb(const byte *pPsData, long sizePsData, const byte **record, uint32_t *const sizeHdr, uint32_t *const sizeData)
Forwards to locateIrb() with psTag = iptc_.
Definition: jpgimage.cpp:229
void printStructure(std::ostream &out, PrintStructureOption option, int depth)
Print out the structure of image file.
Definition: jpgimage.cpp:557
static const byte sof14_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:233
EXIV2API bool isExvType(BasicIo &iIo, bool advance)
Check if the file iIo is an EXV file.
Definition: jpgimage.cpp:1406
Slice< T > makeSlice(T &cont, size_t begin, size_t end)
Return a new slice with the given bounds.
Definition: slice.hpp:665
static const byte sof6_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:227
static const byte app1_
JPEG APP1 marker.
Definition: jpgimage.hpp:218
EXIV2API std::string strError()
Return a system error message and the error code (errno). See strerror(3).
Definition: futils.cpp:316
std::string mimeType() const
Return the MIME type of the image.
Definition: jpgimage.cpp:1376
static const char exifId_[]
Exif identifier.
Definition: jpgimage.hpp:235
ExifData exifData_
Exif data container.
Definition: image.hpp:485
static const byte sof5_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:226
binaryToStringHelper< T > binaryToString(const Slice< T > sl)
format binary data for display in Image::printStructure()
Definition: image_int.hpp:118
void clear()
Delete all Iptcdatum instances resulting in an empty container.
Definition: iptc.hpp:215
virtual bool iccProfileDefined()
Erase iccProfile. the profile is not removed from the actual image until the writeMetadata() method i...
Definition: image.hpp:235
int pixelHeight_
image pixel height
Definition: image.hpp:492
static bool valid(const byte *pPsData, long sizePsData)
Validates all IRBs.
Definition: jpgimage.cpp:132
EXIV2API Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create)
Create a new JpegImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition: jpgimage.cpp:1345
virtual void clearMetadata()
Erase all buffered metadata. Metadata is not removed from the actual image until the writeMetadata() ...
Definition: image.cpp:570
static const byte sof9_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:229
static WriteMethod encode(Blob &blob, const byte *pData, uint32_t size, ByteOrder byteOrder, const ExifData &exifData)
Encode Exif metadata from the provided metadata to binary Exif format.
Definition: exif.cpp:668
EXIV2API Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create)
Create a new ExvImage instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition: jpgimage.cpp:1398
std::string stringFormat(const char *format,...)
format a string in the pattern of sprintf .
Definition: image_int.cpp:32
void setByteOrder(ByteOrder byteOrder)
Set the byte order to encode the Exif metadata in.
Definition: image.cpp:707
EXIV2API void hexdump(std::ostream &os, const byte *buf, long len, long offset=0)
Print len bytes from buf in hex and ASCII format to the given stream, prefixed with the position in t...
Definition: types.cpp:513
ByteOrder byteOrder() const
Return the byte order in which the Exif metadata of the image is encoded. Initially,...
Definition: image.cpp:712
bool isThisType(BasicIo &iIo, bool advance) const
Determine if the content of the BasicIo instance is of the type supported by this class.
Definition: jpgimage.cpp:1340
static void printStructure(std::ostream &out, const Slice< byte * > &bytes, uint32_t depth)
dump iptc formatted binary data (used by printStructure kpsRecursive)
Definition: iptc.cpp:347
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
int pixelWidth_
image pixel width
Definition: image.hpp:491
static const byte sof1_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:223
int writeHeader(BasicIo &oIo) const
Writes the image header (aka signature) to the BasicIo instance.
Definition: jpgimage.cpp:1381
void printTiffStructure(BasicIo &io, std::ostream &out, PrintStructureOption option, int depth, size_t offset=0)
Print out the structure of image file.
Definition: image.cpp:552
bool isThisType(BasicIo &iIo, bool advance) const
Determine if the content of the BasicIo instance is of the type supported by this class.
Definition: jpgimage.cpp:1393
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
EXIV2API long us2Data(byte *buf, uint16_t s, ByteOrder byteOrder)
Convert an unsigned short to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:390
int writeHeader(BasicIo &oIo) const
Writes a Jpeg header (aka signature) to the BasicIo instance.
Definition: jpgimage.cpp:1329
@ useCompactFormat
Use a compact form of RDF.
Definition: xmp_exiv2.hpp:274
std::string mimeType() const
Return the MIME type of the image.
Definition: jpgimage.cpp:1324
virtual int putb(byte data)=0
Write one byte to the IO source. Current IO position is advanced by one byte.
static const byte sof2_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:224
long count() const
Get the number of metadata entries.
Definition: xmp.cpp:533
long size_
The current size of the buffer.
Definition: types.hpp:260
static int encode(std::string &xmpPacket, const XmpData &xmpData, uint16_t formatFlags=useCompactFormat, uint32_t padding=0)
Encode (serialize) XMP metadata from xmpData into a string xmpPacket. The XMP packet returned in the ...
Definition: xmp.cpp:1000
virtual bool eof() const =0
Returns true if the IO position has reached the end, otherwise false.
static const char iccId_[]
ICC profile identifier.
Definition: jpgimage.hpp:238
virtual DataBuf read(long rcount)=0
Read data from the IO source. Reading starts at the current IO position and the position is advanced ...
long count() const
Get the number of metadata entries.
Definition: exif.hpp:514
Class to access JPEG images.
Definition: jpgimage.hpp:289
static const byte eoi_
JPEG EOI marker.
Definition: jpgimage.hpp:216
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
static const char jfifId_[]
JFIF identifier.
Definition: jpgimage.hpp:236
EXIV2API long ul2Data(byte *buf, uint32_t l, ByteOrder byteOrder)
Convert an unsigned long to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:403
Abstract helper base class to access JPEG images.
Definition: jpgimage.hpp:132
static ByteOrder decode(ExifData &exifData, const byte *pData, uint32_t size)
Decode metadata from a buffer pData of length size with binary Exif data to the provided metadata con...
Definition: exif.cpp:636
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
Definition: jpgimage.cpp:353
static const byte sof13_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:232
#define EXV_WARNING
Shorthand for a temp warning log message object and return its ostringstream.
Definition: error.hpp:148
virtual long write(const byte *data, long wcount)=0
Write data to the IO source. Current IO position is advanced by the number of bytes written.
Helper class to access Exiv2 files.
Definition: jpgimage.hpp:350
const int jpeg
JPEG image type (see class JpegImage)
Definition: jpgimage.hpp:39
EXIV2API uint16_t getUShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte unsigned short value from the data buffer.
Definition: types.cpp:273
BasicIo::AutoPtr io_
Image data IO pointer.
Definition: image.hpp:484
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:102
DataBuf iccProfile_
ICC buffer (binary data)
Definition: image.hpp:488
bool usePacket() const
are we to use the packet?
Definition: xmp_exiv2.hpp:245
static const char * irbId_[]
Photoshop IRB markers
Definition: jpgimage.hpp:50
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:81
static const char ps3Id_[]
Photoshop marker
Definition: jpgimage.hpp:49
static const byte sof11_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:231
static const byte sof15_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:234
T add(T summand_1, T summand_2)
Safe addition, throws an exception on overflow.
Definition: safe_op.hpp:288
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
bool writeXmpFromPacket() const
Return the flag indicating the source when writing XMP metadata.
Definition: image.cpp:757
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:324
virtual int writeHeader(BasicIo &oIo) const =0
Writes the image header (aka signature) to the BasicIo instance.
EXIV2API bool isJpegType(BasicIo &iIo, bool advance)
Check if the file iIo is a JPEG image.
Definition: jpgimage.cpp:1354
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:170
static const byte dri_
JPEG DRI marker.
Definition: jpgimage.hpp:214
static DataBuf encode(const IptcData &iptcData)
Encode the IPTC datasets from iptcData to a binary representation in IPTC IIM4 format.
Definition: iptc.cpp:510
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
static const char xmpId_[]
XMP packet identifier.
Definition: jpgimage.hpp:237
static bool isIrb(const byte *pPsData, long sizePsData)
Checks an IRB.
Definition: jpgimage.cpp:121
#define EXV_ERROR
Shorthand for a temp error log message object and return its ostringstream.
Definition: error.hpp:150
virtual int seek(long offset, Position pos)=0
Move the current IO position.
ErrorCode
Complete list of all Exiv2 error codes.
Definition: error.hpp:191
static const uint16_t iptc_
Photoshop IPTC marker
Definition: jpgimage.hpp:52
static DataBuf setIptcIrb(const byte *pPsData, long sizePsData, const IptcData &iptcData)
Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to ...
Definition: jpgimage.cpp:249
static const byte sof10_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:230
static const byte sof7_
JPEG Start-Of-Frame marker.
Definition: jpgimage.hpp:228
Helper class, has methods to deal with Photoshop "Information Resource Blocks" (IRBs).
Definition: jpgimage.hpp:47
An interface for simple binary IO.
Definition: basicio.hpp:55
long count() const
Get the number of metadata entries.
Definition: iptc.hpp:257
XmpData xmpData_
XMP data container.
Definition: image.hpp:487
virtual XmpData & xmpData()
Returns an XmpData instance containing currently buffered XMP data.
Definition: image.cpp:590
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
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
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition: types.hpp:105
static int locatePreviewIrb(const byte *pPsData, long sizePsData, const byte **record, uint32_t *const sizeHdr, uint32_t *const sizeData)
Forwards to locatePreviewIrb() with psTag = preview_.
Definition: jpgimage.cpp:239
static int decode(XmpData &xmpData, const std::string &xmpPacket)
Decode XMP metadata from an XMP packet xmpPacket into xmpData. The format of the XMP packet must foll...
Definition: xmp.cpp:887
static const byte sos_
JPEG SOS marker.
Definition: jpgimage.hpp:215
EXIV2API uint32_t getULong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte unsigned long value from the data buffer.
Definition: types.cpp:278
friend EXIV2API bool isExvType(BasicIo &iIo, bool advance)
Check if the file iIo is an EXV file.
Definition: jpgimage.cpp:1406
Error class for exceptions, log message class.
static const char bimId_[]
Photoshop IRB marker (deprecated)
Definition: jpgimage.hpp:51
std::vector< byte > Blob
Container for binary data.
Definition: types.hpp:151