ImageGear for C and C++ on Windows v19.6 - Updated
JPEG Metadata Structure
User Guide > File Formats and Compressions > File Formats > Metadata Structures > JPEG Metadata Structure

Brief information on JPEG metadata levels is provided in the set of tables below:

JPEG Level

Name Id Type Value Type Value Value Length Read Only
"JPEG-JFIF" IG_FORMAT_JPG LEVEL_START 0 NULL 0 TRUE
JPEG marker segment levels
"JPEG-JFIF" IG_FORMAT_JPG LEVEL_END 0 NULL 0 TRUE

All items between items with Name "JPEG-JFIF" and Id IG_FORMAT_JPG (Type LEVEL_START and LEVEL_END) are interpreted as JPEG metadata. If during sending data from application level to filter level the first item is omitted the data will not be parsed and saved.

JPEG Marker Segment Levels

The following JPEG marker segments metadata are supported:

Frame Marker Segment Level

Name Id Type Value Type Value Value Length Read Only
<Frame marker name> <Frame marker Id> LEVEL_START 0 NULL 0 TRUE
<Frame marker size tag name> <Frame marker size tag Id> VALUE_ITEM UINT16   1 TRUE
"Precision" 212 VALUE_ITEM UINT8   1 TRUE
"Lines" 213 VALUE_ITEM UINT16   1 TRUE
"SamplesPerLine" 214 VALUE_ITEM UINT16   1 TRUE
"ComponentNumber" 215 VALUE_ITEM UINT8 <n> 1 TRUE
Frame component level 1
 
Frame component level <n>
<Frame marker name> <Frame marker Id> LEVEL_END 0 NULL 0 TRUE

<Frame marker Id>, <Frame marker name>, <Frame marker size tag name> and <Frame marker size tag Id> are described in the table below:

Frame Marker <Frame marker name> <Frame marker Id> <Frame marker size tag name> <Frame marker size tag Id>
SOF0 "SOF0" 0xFFC0 "SOF0_DATASIZE" 60192
SOF1 "SOF1" 0xFFC1 "SOF1_DATASIZE" 60193
SOF2 "SOF2" 0xFFC2 "SOF2_DATASIZE" 60194
SOF3 "SOF3" 0xFFC3 "SOF3_DATASIZE" 60195

Frame Component Level

Name Id Type Value Type Value Value Length Read Only
"Component" <Component No.> LEVEL_START 0 NULL 0 TRUE
"Id" <Component No.> VALUE_ITEM UINT   1 TRUE
"MCU_HV" <Component No.> VALUE_ITEM UINT   1 TRUE
"QuantizationNumber" <Component No.> VALUE_ITEM UINT   1 TRUE
"Component" <Component No.> LEVEL_END 0 NULL 0 TRUE
<Component No.> is frame component identifier of appropriate component.

Scan Marker Segment Level

Name Id Type Value Type Value Value Length Read Only
"SOS" 0xFFDA LEVEL_START 0 NULL 0 TRUE
"SOS_DATASIZE" 60218 VALUE_ITEM UINT16   1 TRUE
"ComponentNumber" 228 VALUE_ITEM UINT8 <n> 1 TRUE
Scan component level 1
 
Scan component level <n>
"SpectralStart" 235 VALUE_ITEM UINT8   1 TRUE
"SpectralEnd" 236 VALUE_ITEM UINT8     TRUE
"AH_AL" 237 VALUE_ITEM UINT8     TRUE
"SOS" 0xFFDA LEVEL_START 0 NULL 0 TRUE

Scan Component Level

Name Id Type Value Type Value Value Length Read Only
"Component" <Component No.> LEVEL_START 0 NULL 0 TRUE
"Selector" <Component No.> VALUE_ITEM UINT8   1 TRUE
"DC_AC" <Component No.> VALUE_ITEM UINT8   1 TRUE
"Component" <Component No.> LEVEL_END 0 NULL 0 TRUE
<Component No.> is scan component selector of appropriate component.

Define-Quantization-Table Marker Segment Level

Name Id Type Value Type Value Value Length Read Only
"DQT" 0xFFDB LEVEL_START 0 NULL 0 TRUE
"DQT_DATASIZE" 60219 VALUE_ITEM UINT16   1 TRUE
"QuantizationTable" <table 1 Id> VALUE_ITEM UINT8 or UINT16   64 TRUE
 
"QuantizationTable" <table 1 Id> VALUE_ITEM UINT8 or UINT16   64 TRUE
"DQT" 0xFFDB LEVEL_END 0 NULL 0 TRUE
<table Id> is the appropriate quantization table identifier.

Define-Huffman-Tables Marker Segment Level

Name Id Type Value Type Value Value Length Read Only
"DHT" 0xFFC4 LEVEL_START 0 NULL 0 TRUE
"DHT_DATASIZE" 60196 VALUE_ITEM UINT16   1 TRUE
"DATA" 0xFFC4 VALUE_ITEM RAW_DATA   <ValueSize> TRUE
"DHT" 0xFFC4 LEVEL_END 0 NULL 0 TRUE

Comment Marker Segment Level

Name Id Type Value Type Value Value Length Read Only
"COM" 0xFFFE LEVEL_START 0 NULL 0 TRUE
"COM_DATASIZE" 60254 VALUE_ITEM UINT16   1 TRUE
"Comment" 0xFFFE VALUE_ITEM STRING   <ValueSize> TRUE
"COM" 0xFFFE LEVEL_END 0 NULL 0 TRUE

Application Marker Segment Level

There are several application marker segments, which data structure is well known. These segments are parsed and their data are passed in special format.

These marker segments are:

JFIF APP0 Segment

Name Id Type Value Type Value Value Length Read Only
"APP0" 0xFFE0 LEVEL_START 0 NULL 0 TRUE
"APP0_DATASIZE" 60224 VALUE_ITEM UINT16   1 FALSE
"JFIF_HEADER" 200 VALUE_ITEM STRING JFIF 5 TRUE
"Version" 201 VALUE_ITEM UINT16   1 FALSE
"ResolutionUnits" 202 VALUE_ITEM UINT8   1 FALSE
"ResolutionX" 203 VALUE_ITEM UINT16   1 FALSE
"ResolutionY" 204 VALUE_ITEM UINT16   1 FALSE
"ThumbnailWidth"1 205 VALUE_ITEM UINT8   1 TRUE
"ThumbnailHeight"2 206 VALUE_ITEM UINT8   1 TRUE
"APP0" 0xFFE0 LEVEL_END 0 NULL 0 TRUE

1The thumbnail width tags are present only if the thumbnail is stored to JFIF segment.

2The thumbnail height tags are present only if the thumbnail is stored to JFIF segment.

JFIF Extension (JFXX) APP0 Segment

Name Id Type Value Type Value Value Length Read Only
"APP0" 0xFFE0 LEVEL_START 0 NULL 0 TRUE
"APP0_DATASIZE" 60224 VALUE_ITEM UINT16   1 TRUE
"JFIF_EX_HEADER" 209 VALUE_ITEM STRING "JFXX" 5 TRUE
"ExtensionCode" 210 VALUE_ITEM UINT8   1 TRUE
"APP0" 0xFFE0 LEVEL_END 0 NULL 0 TRUE

Photoshop Image Resource APP13 Marker Segment

Name Id Type Value Type Value Value Length Read Only
"APP13" 0xFFED LEVEL_START 0 NULL 0 TRUE
"APP13_DATASIZE" 60237 VALUE_ITEM UINT16   1 FALSE
"PHOTOSHOP_HEADER" 59915 VALUE_ITEM STRING "Photoshop 3.0" 14 FALSE
Photoshop Image Resource level 1
...
Photoshop Image Resource level n
"APP13" 0xFFED LEVEL_END 0 NULL 0 TRUE
For "Photoshop Image Resource" metadata structure see in TIFF non-image data the Photoshop Image Resource metadata structure table.

Other Application Marker Segment Levels

Name Id Type Value Type Value Value Length Read Only
<Marker name> <Marker Id> LEVEL_START 0 NULL 0 TRUE
<Marker size tag name> <Marker size tag Id> VALUE_ITEM UINT16   1 FALSE
"DATA" <Marker Id> VALUE_ITEM RAW_DATA   <ValueSize> FALSE
<Marker name> <Marker Id> LEVEL_END 0 NULL 0 TRUE

<Marker Id>, <Marker name>, <Marker size tag name> and <Marker size tag Id> are in table below:

Marker <Marker name> <Marker Id> <Marker size tag name> <Marker size tag Id>
APP0 "APP0" 0xFFE0 "APP0_DATASIZE" 60224
APP1 "APP1" 0xFFE1 "APP1_DATASIZE" 60225
APP2 "APP2" 0xFFE2 "APP2_DATASIZE" 60226
APP3 "APP3" 0xFFE3 "APP3_DATASIZE" 60227
APP4 "APP4" 0xFFE4 "APP4_DATASIZE" 60228
APP5 "APP5" 0xFFE5 "APP5_DATASIZE" 60229
APP6 "APP6" 0xFFE6 "APP6_DATASIZE" 60230
APP7 "APP7" 0xFFE7 "APP7_DATASIZE" 60231
APP8 "APP8" 0xFFE8 "APP8_DATASIZE" 60232
APP9 "APP9" 0xFFE9 "APP9_DATASIZE" 60233
APP10 "APP10" 0xFFEA "APP10_DATASIZE" 60234
APP11 "APP11" 0xFFEB "APP11_DATASIZE" 60235
APP12 "APP12" 0xFFEC "APP12_DATASIZE" 60236
APP13 "APP13" 0xFFED "APP13_DATASIZE" 60237
APP14 "APP14" 0xFFEE "APP14_DATASIZE" 60238
APP15 "APP15" 0xFFEF "APP15_DATASIZE" 60239

Callback Required for Writing JPEG Metadata Items

All JPEG metadata items can be written using LPAFT_IG_METAD_ITEM_ADD_CB callback only.

JPEG Metadata Item Name and ID Constants

Please see enumIGJPGTagIDs for a complete list of JPEG Metadata Id constants.