Native Image Format Metadata Queries
This topic provides an overview of the metadata query language queries for reading and writing metadata supported by GIF, PNG, TIFF and Jpeg images.
This topic contains the following sections.
Prerequisites
To understand this topic, you should be familiar with the Windows Imaging Component (WIC) metadata system as described in the WIC Metadata Overview. You should also be familiar with the query language used to read and write metadata, as described in Metadata Query Language Overview.
Introduction
The following sections contain tables that list the available metadata queries for each image file type. Each table has the following columns:
- Path - The query path used to retrieve the metadata item.
- Name - The name of the metadata item.
- Type - The type of the metadata item retrieved from the query path.
The query paths are used by the WIC metadata API to access the embedded metadata of an image. The following example code demonstrates using an IWICMetadataQueryReader to query for a JPEG's IFD metadata block.
// Not shown: image decoding
IWICMetadataQueryReader *pQueryReader = NULL;
IWICMetadataQueryReader *pIFDReader = NULL;
// Get the query reader.
if (SUCCEEDED(hr))
{
hr = pFrameDecode->GetMetadataQueryReader(&pQueryReader);
}
if (SUCCEEDED(hr))
{
// Get the nested IFD reader.
hr = pQueryReader->GetMetadataByName(L"/app1/ifd", &value);
if (value.vt == VT_UNKNOWN)
{
hr = value.punkVal->QueryInterface(IID_IWICMetadataQueryReader, (void **)&pIFDReader);
}
PropVariantClear(&value); // Clear value for new query.
}
GIF Metadata
The Graphics Interchange Format (GIF) image format supports both global and frame level metadata. The following two sections provide the metadata query paths available for GIF's global and frame level metadata.
Global Metadata
The following table provides the available metadata query paths that can be used to access global GIF metadata.
| Path | Name | Type |
|---|---|---|
| /commentext or /[*]commentext where * = 0 to N | Comment Extension | VT_UNKNOWN - A query reader/writer |
| /commentext/TextEntry | VT_LPSTR | |
| /logscrdesc | Logical Screen Description | VT_UNKNOWN - A query reader/writer |
| /logscrdesc/Signature | VT_UI1 | VT_VECTOR | |
| /logscrdesc/Height | VT_UI2 | |
| /logscrdesc/GlobalColorTableFlag | VT_UI2 | |
| /logscrdesc/ColorResolution | VT_BOOL | |
| /logscrdesc/SortFlag | VT_UI1 | |
| /logscrdesc/GlobalColorTableSize | BOOL | |
| /logscrdesc/BackgroundColorIndex | VT_UI1 | |
| /logscrdesc/PixelAspectRatio | VT_UI1 | |
| /appext or /[*]appext where * = 0 to N | Application Extension | VT_UNKNOWN - A query reader/writer |
| /appext/Application | VT_UI1 | VT_VECTOR | |
| /appext/Data | VT_UI1 | VT_VECTOR |
Frame Metadata
The following table provides the available metadata query paths that can be used to access frame level GIF metadata.
| Path | Name | Type |
|---|---|---|
| /grctlext | Graphic Control Extension | VT_UNKNOWN - query reader/writer |
| /grctlext/Disposal | VT_UI1 | |
| /grctlext/UserInputFlag | VT_BOOL | |
| /grctlext/TransparencyFlag | VT_BOOL | |
| /grctlext/Delay | VT_UI2 | |
| /grctlext/TransparentColorIndex | VT_UI1 | |
| /imgdesc | Image Descriptor | VT_UNKNOWN - query reader/writer |
| /imgdesc/Left | VT_UI2 | |
| /imgdesc/Top | VT_UI2 | |
| /imgdesc/Width | VT_UI2 | |
| /imgdesc/Height | VT_UI2 | |
| /imgdesc/LocalColorTableFlag | VT_BOOL | |
| /imgdesc/InterlaceFlag | VT_BOOL | |
| /imgdesc/SortFlag | VT_BOOL | |
| /imgdesc/LocalColorTableSize | VT_UI1 |
PNG Metadata
The Portable Network Graphics (PNG) image format supports frame level metadata.
Frame Metadata
The following table provides the available metadata query paths that can be used to access frame level PNG metadata.
| Path | Name | Type |
|---|---|---|
| /tEXt or /[*]tEXt where * = 0 to N | Text Chunk | VT_UNKNOWN - tEXt query reader/writer |
| /tEXt/{str=*} where * = identifying keyword for text | VT_LPSTR | |
| /gAMA | Gama Chunk | VT_UNKNOWN - gAMA query reader/writer |
| /gAMA/ImageGamma | VT_UI4 | |
| /iTXt or /[*]iTXt where * = 0 to N | IText Chunk | VT_UNKNOWN - iTXt query reader/writer |
| /iTXt/Keyword | VT_LPSTR | |
| /iTXt/CompressionFlag | VT_UI1 | |
| /iTXt/LanguageTag | LPSTR | |
| /iTXt/TranslatedKeyword | LPWSTR | |
| /iTXt/TextEntry | LPWSTR | |
| /cHRM | HRM Chunk | VT_UNKNOWN - cHRM query reader/writer |
| /cHRM/WhitePointX | VT_UI4 | |
| /cHRM/WhitePointY | VT_UI4 | |
| /cHRM/RedX | VT_UI4 | |
| /cHRM/RedY | VT_UI4 | |
| /cHRM/GreenX | VT_UI4 | |
| /cHRM/GreenY | VT_UI4 | |
| /cHRM/BlueX | VT_UI4 | |
| /cHRM/BlueY | VT_UI4 | |
| /sRGB | sRGB Chuck | VT_UNKNOWN - sRGB query reader/writer |
| /sRGB/RenderingIntent | VT_UI1 | |
| /tIME | Time Chunk | VT_UNKNOWN - tIME query reader/writer |
| /tIME/Year | VT_UI2 | |
| /tIME/Month | VT_UI1 | |
| /tIME/Day | VT_UI1 | |
| /tIME/Hour | VT_UI1 | |
| /tIME/Minute | VT_UI1 | |
| /tIME/Second | VT_UI1 | |
| /bKGD | Background Chunk | VT_UNKNOWN - bKGB query reader/writer |
| /bKGD/BackgroundColor | VT_UI1, VT_UI2 or VT_UI2 | VT_VECTOR | |
| /hIST | hIST Chunk | VT_UNKNOWN - hIST query reader/writer |
| /hIST/Frequencies | VT_VECTOR | VT_UI2 | |
| /iCCP | iCCP Chunk | VT_UNKNOWN - iCCP query reader/writer |
| /iCCP/ProfileName | VT_LPSTR | |
| /iCCP/ProfileData | VT_VECTOR | VT_UI1 |
For details about PNG
TIFF Metadata
The Tagged Image File Format (TIFF) image format supports frame level metadata.
Frame Metadata
The following table provides the available metadata query paths that can be used to access frame level TIFF metadata.
| Path | Name | Type |
|---|---|---|
| /ifd | 0 IFD | VT_UNKNOWN - A query reader/writer |
| /ifd/{ushort=*} where * = 0 to 65535 | IFD Entry by ID | Variable |
| /ifd/thumb or /ifd/{ushort=330} | Thumbnail IFD | VT_UNKNOWN - A query reader/writer |
| /ifd/xmp or /ifd/{ushort=700} | XMP | VT_UNKNOWN - A query reader/writer |
| /ifd/exif or /ifd/{ushort=34665} | EXIF | VT_UNKNOWN - A query reader/writer |
| /ifd/gps or /ifd/{ushort=34853} | GPS | VT_UNKNOWN - A query reader/writer |
| /ifd/exif/interop or /ifd/exif/{ushort=40965} | Interop | VT_UNKNOWN - A query reader/writer |
| /ifd/iptc or /ifd/{ushort=33723} | IPTC | VT_UNKNOWN - A query reader/writer |
| /ifd/iptc/{str=*} where * = IPTC keyword | IPTC Entry | Variable |
| /ifd/irb/8bimiptc/iptc | IPTC | VT_UNKNOWN - A query reader/writer |
| /ifd/irb/8bimiptc/iptc/{str=*} | IPTC Entry | Variable |
Jpeg Metadata
The JPEG image format supports frame level metadata.
Frame Metadata
The following table provides the available metadata query paths that can be used to access frame level JPEG metadata.
| Path | Name | Type |
|---|---|---|
| /app0 | App0 | VT_UNKNOWN - App0 Query Reader/Writer |
| /app0/{ushort=0} | Version | VT_UI2 |
| /app0/{ushort=1} | Units | VT_UI1 |
| /app0/{ushort=2} | DpiX | VT_UI2 |
| /app0/{ushort=3} | DpiY | VT_UI2 |
| /app0/{ushort=4} | Xthumbnail | VT_UI1 |
| /app0/{ushort=5} | Ythumbnail | VT_UI1 |
| /app0/{ushort=6} | ThumbnailData | VT_BLOB |
| /app1 | App1 | VT_UNKNOWN - App1 Query Reader/Writer |
| /app1/ifd/ or /app1/{ushort=0} | 0 IFD | VT_UNKNOWN - IFD Query Reader/Writer |
| /app1/thumb/ or /app1/{ushort=1} | Thumbnail IFD | VT_UNKNOWN - SubIFD Query Reader/Writer |
| /app13 | App13 | VT_UNKNOWN - App13 Query Reader/Writer |
| /app13/irb or /app13/{ushort=0} | IRB | VT_UNKNOWN - IRB Query Reader/Writer |
| /app13/irb/{ulonglong=*} where * = IRB Identifier (see IRB spec) | IRB Entry | VT_UNKNOWN - Unknown Query Reader/Writer |
| /app13/irb/{ulonglong=*}/{} | IRB Entry Contents | VT_BLOB |
| /app13/irb/8bimiptc or /app13/irb/{ulonglong=61857348781060} | 8BIMIPTC | VT_UNKNOWN - 8BIMIPTC Query Reader/Writer |
| /app13/irb/8bimiptc/iptc | IPTC | VT_UNKNOWN - IPTC Query Reader/Writer |
| /app13/irb/8bimiptc/iptc/{str=*} | IPTC Entry | Variable |
| /app13/irb/8bimResInfo or /app13/irb/{ulonglong=61857348781037} | 8BIM Resolution Info | VT_UNKNOWN - Query Reader/Writer |
| /app13/irb/8bimResInfo/PString | VT_LPSTR | |
| /app13/irb/8bimResInfo/HResolution | VT_UI4 | |
| /app13/irb/8bimResInfo/VResolution | VT_UI4 | |
| /app13/irb/8bimResInfo/WidthUnit | VT_UI2 | |
| /app13/irb/8bimResInfo/HeightUnit | VT_UI2 | |
| /app13/irb/8bimResInfo/HResolutionUnit | VT_UI2 | |
| /app13/irb/8bimResInfo/VResolutionUnit | VT_UI2 | |
| /com | Jpeg Comment | VT_UNKNOWN - Comment Query Reader/Writer |
| /com/TextEntry | LPSTR | |
| /luminance | Luminance | VT_UNKNOWN - Luminance Query Reader/Writer |
| /luminance/TableEntry | VT_UI1 | VT_VECTOR | |
| /chrominance | Chrominance | VT_UNKNOWN - Chrominance Query Reader/Writer |
| /chrominance/TableEntry | VT_UI1 | VT_VECTOR | |
| /xmp | XMP | VT_UNKNOWN - XMP Query Reader/Writer |
Related topics
- Conceptual
- Windows Imaging Component Overview
- WIC Metadata Overview
- Metadata Query Language Overview
- Metadata Extensibility Overview
- How-to: Re-encode a JPEG Image with Metadata
Send comments about this topic to Microsoft
Build date: 3/14/2012