J2K-Codec ™

News
Overview
Download
Order
F.A.Q.
More info
Support
Links

Welcome
QuickStart

ActiveX Control

C++ Wrapper
J2K_Image
open
easyDecode
selectTiles
getMetaData
decode
close
J2K_Frames
open
getFrames
getFrame
operators
close

API Reference
General
getVersion
getLastError
getErrorStr
getLastErrorStr
Unlock
Open / Close
Open
Close
Info
GetInfo
GetInfoEx
GetResolutions
GetResDimensions
GetMetaData
Decoding
EasyDecode
SelectTiles
Decode
Cancel
Debug
StartLogging
StopLogging


J2K_GetMetaData


Use this function only if you need to extract some additional, vendor specific meta data, embedded into JP2 files.

int J2K_GetMetaData(void *image, int *no, int *type, unsigned char **data, int *size);


Parameters

image
A pointer, obtained from J2K_Open().

no
A meta data block number. Set to 0 to start enumeration from the beginning. Each call will automatically advance it.

type
Type of the meta data block. This version of J2K-Codec supports the following types:
JP2_METADATA_COMMENT_STR
JP2_METADATA_COMMENT_BIN
JP2_METADATA_GEOTIFF
JP2_METADATA_XML
JP2_METADATA_URL
JP2_METADATA_PAL
JP2_METADATA_ICC
JP2_METADATA_UNKNOWN

data
Points to a variable where the meta data pointer will be placed. If the pointer returned is NULL, then there are no more meta data blocks.

size
Size of the meta data block.

Return value

Returns J2KERR_SUCCESS or an error code if the function has failed. See the list of error codes here.

Notes

1. See "C++\i_GeoTIFF" or "VB.NET\c_MetaData" samples for more information.

2. JP2_METADATA_PAL means JP2 palette as specified in the JPEG2000 standard.

3. JP2_METADATA_ICC means JP2 ICC profile.

4. In case of J2K_METADATA_UNKNOWN the data will be returned "as is", i.e. prefixed with 16-byte ID.

Example

unsigned char *meta_data; int md_type, md_size, no=0;

while(1)
{
   int j2k_err = J2K_GetMetaData(j2k_image, &no;, &md;_type, &meta;_data, &md;_size);
   if(j2k_err != J2KERR_SUCCESS) return -1;

   if(!meta_data) break; // End of enumeration

   if(md_type == JP2_METADATA_GEOTIFF)
   {
      // Process GeoTIFF here
   }
}

See also

J2K_Open()
2004-2008 © Alex Saveliev