AutoPtr<DataStore> metadata = image->getMetadata(); const void *ptr; u16 type; size_t count; // (1) By string ptr = TIFF6::get(metadata, "InterColorProfile"); // (2) By tag number ptr = TIFF6::get(metadata, 34675);
TIFF_RATIONAL xRes = TIFF6::getAsRATIONAL(metadata, "Exif IFD Pointer:XResolution"); TIFF_RATIONAL yRes = TIFF6::getAsRATIONAL(metadata, "Exif IFD Pointer:YResolution");
:' as path separator and the code above illustrates this.if(TIFF6::verify(metadata, "HostComputer")) { // "HostComputer" is there. } else { // No "HostComputer" }
if(TIFF6::verify(metadata, 316)) // 316="HostComputer" ...
if(TIFF6::verify(metadata, "XResolution", TIFF6::RATIONAL) { // Yes, "XResolution" is in RATIONAL. u16 type; u32 count; const TIFF_RATIONAL& xRes = TIFF6::get(metadata, "XResolution", type, count); } else { // The data does not comply with TIFF 6.0 spec. }
if(TIFF6::verify(metadata, "Exif IFD Pointer::DateTimeOriginal", TIFF6::ASCII, 20) { // Yes, "DateTimeOriginal" is in ASCII and count is 20. } ...
TIFF_RATIONAL xRes = MetadataUtils::getXResolution(metadata, MetadataUtils::Inch); TIFF_RATIONAL yRes = MetadataUtils::getYResolution(metadata, MetadataUtils::Inch);
u16 pageNum = 3; TIFF6::set(metadata, "PageNumber", TIFF6::SHORT, 1, &pagenum);
If you want to modify the ASCII typed tags, the code is much simple:
TIFF6::set(metadata, "Exif IFD Pointer:ImageUniqueID", "35513A3606DA45b3895AA428DA77E2FD");
NULL when error occurs (TIFF6::getAsString returns NullString instead).For the information about modifying Metadata before exporting, see Modifying Metadata for Exporting Images.
"PixelLive". The following code illustrates how to access to them: AutoPtr<DataStore> metadata = image->getMetadata();
String vfzTitle = metadata->getAsString("PixelLive/TITLE", '/');
String vfzAuthor = metadata->getAsString("PixelLive/AUTHOR", '/');
GUID vfzGuid = metadata->getAsGUID("PixelLive/GUID", '/');
DataStore has many getAsXXX functions and usually they accept two parameters. The first one is the location of the data. The second one is the path separator. In the sample above, the location is separated by '/'. You can also change the separator for the data like the following code:
String vfzTitle = metadata->getAsString("PixelLive|TITLE", '|');
virtual AutoPtr<DataStore> getMetadata() const { AutoPtr<DataStore> metadata = m_image->getMetadata(); if(m_profDst.isValid()) { // We should replace color profile if it is not compatible with // the new photometric... TIFF6::set( metadata, "InterColorProfile", // 34675 TIFF6::UNDEFINED, m_profDst->getRawData().getSize(), m_profDst->getRawData().getPtr()); } else { // simply remove the profile. metadata->unlink("InterColorProfile"); } return metadata; }