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

The ImageGear JPEG 2000 Component allows you to work with non-image data stored in supported file formats. It provides the ability to work with the following types of non-image information:

JP2 Metadata Tags

The following metadata tags are supported for JP2 files:

JPX Metadata Tags

The following metadata tags are supported for JPX files:

JPEG 2000 Metadata Tags Reference

"AlphaMapping"

This tag establishes the relationship, if any, between color channels and alpha (and/or pre-multiplied) alpha channels. Each element of the array specifies the index of the alpha channel associated with a regular (color) channel. Zero or negative value means absence of alpha mapping for particular color channel. For example:

"AlphaMapping" with {1, 1, 1, -1} value means that red, green, and blue channels of the image are mapped to the same (first) alpha channel. In this case, ImageGear loads the Alpha channel into the Alpha (or Pre-multiplied Alpha) channel of its DIB.

"AlphaMapping" with {-1, 2, 1, -1} value means that Alpha channel associations are different for each color channel. Green and blue channels use two different Alpha channels, and the Red channel does not have an associated Alpha channel. Currently, ImageGear does not support applying Alpha channels separately to color channels. Hence, it loads such Alpha channels into Extra channels of the ImageGear DIB. The Alpha channel associated with the Green channel will be loaded into Extra channel 1; the Alpha channel associated with the Blue channel will be loaded into Extra channel 0.

The AlphaMapping tag uses 1-based indexes for Alpha channels, but HIGEAR uses 0-based indexes for its Extra channels.

Additional information about available Alpha channels can be accessed through "Alpha1", "Alpha2", "Alpha3", and "Alpha4" tags.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

"Alpha1", "Alpha2", "Alpha3", "Alpha4"

Each of these tags represents information about Alpha channels. Valid value for each tag is an array with three integer elements.

For example:

"Alpha1" equal to {0, 3, 0} means that the first Alpha channel is located in component #3 of the code stream #0, and it is non-pre-multiplied. “Alpha1” equal to {1, 0, 1} means that the first Alpha channel is located at component #0 of the code stream #1 and is pre-multiplied.

For JP2 file format, the value of the first element (codestream index) is restricted to {-1, 0}. Only JPX files allow storing Alpha channels in a separate codestream.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

"Chroma"

This tag contains an array of 4 AT_INT32 Chroma key values for each channel. If the image does not contain a Chroma key, all array elements are set to -1. If the image contains a Chroma key but has fewer than 4 channels, unused array elements are set to -1.

Chroma key specifies the pixel value that should be considered fully transparent.

ImageGear only provides this Chroma key value in the metadata, and does not take it into account in image display. ImageGear currently does not support saving the Chroma Key value.

"Comment"

This tag serves for getting and setting the Comment (CME segment data).

If you don’t provide a value for this tag during the writing (return FALSE from LPAFT_IG_METAD_ITEM_SET_CB callback, or don’t implement this callback at all), ImageGear will write its version stamp to the Comment tag.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

"CompressionType"

This tag serves for getting ImageGear’s best guess on the compression type (Lossy or Lossless) of a JPEG2K image that has been loaded. See enumJPEG2KType for possible values.

This tag provides a high degree of confidence for JPEG 2000 images saved by real world applications. However, it is impossible to guarantee that a JPEG 2000 image is lossless. On the other hand, IG_JPEG2K_TYPE_LOSSY value returned by this metadata tag does guarantee that lossy compression was used when saving this image.

This tag is ignored during image writing. Use WAVELET_FILTER and (RATE_BYTES or QUALITY_LAYERS) control parameters to set the Lossy or Lossless compression for saving.

"Format"

This tag serves for getting the file format of a JPEG 2000 file (JP2 compatible or Raw Codestream). See enumJPEG2KFormat for possible values.

This tag is ignored during image writing. Use the FILE_FORMAT control parameter to specify the format (JP2 compatible or Raw Codestream) for image writing.

"IPR"

This tag serves for getting and setting IPR (Intellectual Property Rights) information. The IPR metadata defines metadata to either protect the rights of the owner of the image or provide further information to request permission to use it. It is important for developers and users to properly protect the rights of the owner of the image data.

Valid value for this tag is a zero-terminated ANSI string.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

"Resolution"

This metadata level contains resolution information found in JP2 and JPX images. It contains four fields of type Double that specify resolution values, in pixels per meter:

If either or both Capture and Display resolution is not present in the image, corresponding fields are set to 0.0.

See also the RESOLUTION_MODE control parameter in the appropriate file format section.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

"UUID"

This metadata level contains Universally Unique Identifier information found in JP2 and JPX images. The content of the level depends on the kind of UUID data and on the global parameter setting.

If the data contained in UUID is an XMP packet, and XMP.PARSE control parameter is set to TRUE then the level content is:

Otherwise, the level content is:

Use LPAFT_IG_METAD_ITEM_ADD_CB callback to change the value of this tag.

"UUID Info"

This metadata level contains additional information about UUID identifiers.

Use LPAFT_IG_METAD_ITEM_ADD_CB callback to change the value of this tag.

"XML"

This tag serves for getting and setting some specific information written in XML format.

Valid value for this tag is a zero-terminated ANSI string.

Use LPAFT_IG_METAD_ITEM_SET_CB callback to change the value of this tag.

Metadata Updating

JPEG 2000 and JPX format filters allow updating image metadata without decoding and encoding the image. ImageGear allows updating the following metadata tags for JPEG 2000 and JPX filters:  

To remove a Comment, IPR or XML metadata tag from a file, pass NULL to the NewItemValue parameter and 0 to the NewValueLength parameter of the LPAFT_IG_METAD_ITEM_SET_CB callback.

ImageGear currently does not allow removing or resetting the Resolution metadata to zeroes during metadata updating. Use the regular loading and saving functions if you need to remove resolution information from a JP2 or JPX file.

ImageGear also allows the conversion between JP2 file format and JPEG 2000 raw codestream by means of the metadata updating feature. Use the FILE_FORMAT control parameter of the JPEG 2000 format filter to control the destination file format. See Updating Non-Image Data without Loading and Saving the Image for more details.

See Also

File Formats