J2K-Codec ™

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

Welcome
QuickStart

ActiveX Control

C++ Wrapper
J2K_Image
open
easyDecode
selectTiles
getCustomData
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
GetCustomData
Decoding
EasyDecode
SelectTiles
Decode
Cancel
Debug
StartLogging
StopLogging


J2K_GetCustomData


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

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


Parameters

image
A pointer, obtained from J2K_Open().

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

type
Type of the custom data block. This version of J2K-Codec supports only 1 type: JP2_CDATA_GEOTIFF.

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

size
Size of the custom data block.

Return value

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

Notes

See "i_GeoTIFF" sample for more information.

Example

unsigned char *geo_data; int geo_type, geo_size, no=0;

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

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

   if(geo_type == JP2_CDATA_GEOTIFF)
   {
      // Process GeoTIFF here
   }
}

See also

J2K_Open()
2004-2006 © Alex Saveliev