## Tags

QPix provides access for non image data present in some kinds of images, also known as meta-data, or simply tags. The classes of images tags supported by QPix are:

TIFF tags

  Found in TIFF and Exif JPEG files.

Exif tags

  Found in Exif TIFF and Exif JPEG files. Defined in the Exif 2.1 spec.

GPS tags

  Tags containing Global Positioning System information. Found in some Exif TIFF and Exif JPEG files. Defined in the Exif 2.1 spec.

IPTC tags

  Found in JPEG, TIFF, and PhotoShop files.

QuickTime tags

  Tags specific to QuickTime, and tags mapped from other classes.

### Tag anatomy

A tag consists of two primary parts: the tag ID and the tag data.

The tag ID is a longint identifier that uniquely indentifies the tag. For example, the keywords IPTC tag is identified by 0x49500019. QPix includes constants for common tags of all supported classes.

Tag IDs are formed in such a way that they also contain the class of the tag in the higher 1 or 2 bytes of the longint number.

For example, the keywords IPTC tag can be split to two parts: 0x4950 identifies the class of the tag, and 0x0019 is the unique ID of the tag within the IPTC class. These two pieces together uniquely identify the specific tag among all tags of all classes.

By using this convension it is easy to find out the class of a tag given its ID, without having to look it up on predefined arrays or tables of tag IDs.

To identify the class of a tag given its ID, use the prefix constants listed below and the corresponding boolean expressions:

qpx_TIFFTagPrefix | 0x74690000 | The high word of the tag ID contains the 'ti' characters. To test for a TIFF tag, use the boolean expression: ((tagID & 0xFFFF0000) = qpx_TIFFTagPrefix)
qpx_ExifTagPrefix | 0x65780000 | The high word of the tag ID contains the 'ex' characters. To test for an Exif tag, use the boolean expression: ((tagID & 0xFFFF0000) = qpx_ExifTagPrefix)
qpx_GPSTagPrefix | 0x67700000 | The high word of the tag ID contains the 'gp' characters. To test for a GPS tag, use the boolean expression: ((tagID & 0xFFFF0000) = qpx_GPSTagPrefix)
qpx_IPTCTagPrefix | 0x49500000 | The high word of the tag ID contains the 'IP' characters. To test for an IPTC tag, use the boolean expression: ((tagID & 0xFFFF0000) = qpx_IPTCTagPrefix)
qpx_QTTagPrefix | 0xA9000000 | The high byte of the tag ID contains the '©' character. To test for a QuickTime tag, use the boolean expression: ((tagID & 0xFF000000) = qpx_QTTagPrefix)

The tag data is the content or value of a tag.

The data of most tags consist of a single unit of information (single-element tags). However, the data of some tags such as the keywords IPTC tag mentioned above, may consist of multiple elements.

QPix includes commands that return the tag data and the number of data elements of a tag.

The data of a single-element tag is returned in a text variable. For a multi-element tag, QPix returns a text array containing all data elements of the tag, and also a concatenated form of the data elements in a text variable.

### Working with image tags

First extract the tag container from the source image. The tag container is a BLOB containing all tags present in the source image. To extract the tag container, call QPx_GetImageFileTagContainer when working with image files, or QPx_GetImporterTagContainer when working with graphics importers.

Once you have the tag container BLOB, call QPx_OpenTagContainer. This command opens the container BLOB and returns a reference number (a longint) that is used by other commands that return information about the tags.

After opening the tag container, you can call QPx_GetTagInstances to get a list of all tags present in the tag container, and QPx_GetTagInstanceInfo/QPx_GetTagInstanceText to get information about specific tags.

Finally, call QPx_CloseTagContainer to release any memory allocated by QPx_OpenTagContainer.

QPx_OpenTagContainer | Opens a tag container
QPx_CloseTagContainer | Closes a tag container
QPx_GetTagInstances | Retrieves all tags present in a tag container
QPx_GetTagInstanceInfo | Returns the number of data elements of a specific tag
QPx_GetTagInstanceText | Returns the data of a specific tag in textual form
QPx_GetTagTitle | Looks up the title of a tag

QPix © Escape
Generated by QDoc 2.8 on Wed, Feb 17, 2010 17:45:12