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:
- Alpha channels mapping
- Comment
- Type of compression (lossy, lossless)
- Format type information
- IPR information
- Capture and display resolution
- XML information
Information on the JPEG 2000 metadata tags supported by ImageGear is provided below:
JP2 Metadata Tags
The following metadata tags are supported for JP2 files:
- "AlphaMapping"
- "Alpha1", "Alpha2", "Alpha3"
- "Comment"
- "CompressionType"
- "Format"
- "IPR"
- "Resolution"
- "XML"
JPX Metadata Tags
The following metadata tags are supported for JPX files:
- "AlphaMapping"
- "Alpha1", "Alpha2", "Alpha3", "Alpha4"
- "Comment"
- "Chroma"
- "IPR"
- "Resolution"
- "XML"
JPEG 2000 Metadata Tags Reference
The value of these tags below can be changed using LPAFT_IG_METAD_ITEM_SET_CB callback only. LPAFT_IG_METAD_ITEM_ADD_CB callback is not used with JPEG 2000 formats. |
Information on JPEG 2000 metadata tags is provided in the following sections:
"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.
"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.
- The first element represents the index of the code stream, in which the Alpha channel is stored (in case of reading) or should be stored (in case of writing). Valid values are -1 (no association) or a non-negative integer.
- The second element represents the index of the component in which the Alpha channel is stored (in case of reading) or should be stored (in case of writing). Valid values are -1 (no association) or a non-negative integer.
- The third element specifies whether Alpha is regular (0) or pre-multiplied (1). It is set to -1 in case of no association.
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. |
"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).
"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.
"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:
- CaptureResolution X
- CaptureResolution Y
- DisplayResolution X
- DisplayResolution Y
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.
"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.