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
- UUID information (includes XMP metadata)
- XML information
JP2 Metadata Tags
The following metadata tags are supported for JP2 files:
- "AlphaMapping"
- "Alpha1", "Alpha2", "Alpha3"
- "Comment"
- "CompressionType"
- "Format"
- "IPR"
- "Resolution"
- "UUID"
- "UUID Info"
- "XML"
JPX Metadata Tags
The following metadata tags are supported for JPX files:
- "AlphaMapping"
- "Alpha1", "Alpha2", "Alpha3", "Alpha4"
- "Chroma"
- "Comment"
- "IPR"
- "Resolution"
- "UUID"
- "UUID Info"
- "XML"
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.
"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).
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.
"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.
"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:
- UUID ID - Universally Unique Identifier represented as an array of 16 byte values.
- XMP - XMP metadata level (see XMP Non-Image Data Structure).
Otherwise, the level content is:
- UUID ID - Universally Unique Identifier represented as an array of 16 byte values.
- UUID Data - UUID data represented as an array of bytes.
"UUID Info"
This metadata level contains additional information about UUID identifiers.
- UUID Info List
This metadata level contains a list of UUID identifiers.
- UUID Info URL
This tag contains the URL that provides additional information about the UUIDs contained in the UUID Info metadata tree. Type of the metadata value is string.
"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.
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:
- "Comment"
- "IPR"
- "Resolution"
- "UUID"
- "UUID Info"
- "XML"
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