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_Open


Use this function to create an internal object, associated with a file, memory buffer or custom data source.

void* J2K_OpenFile(const char *filename);
void* J2K_OpenMemory(unsigned char *src_buffer, int src_size);
void* J2K_OpenCustom(void *data_source, J2K_Callbacks *cbs);


Parameters

src_buffer
Pointer to a memory buffer, which contains a JPEG 2000 file.

src_size
Size of data in the memory buffer (in bytes).

data_source
Pointer to a data source identifier to be passed to callback routines unchanged. See "Custom Data Sources" section for more information.

cbs
Pointer to a special structure with callbacks. See "Custom Data Sources" section for more information.

Return value

Returns pointer to an internal object, associated with a file, memory buffer, custom data source, or 0 if there was an error. Use J2K_getLastError() to obtain the error code.

Notes

1. The internal object, created by this function is initially "blank". No significant memory is allocated.
This allows to get information about a J2K image in relatively cheap way if that's the only thing you need.

2. Every image, opened with this function, must be closed with J2K_Close() to avoid memory leaks.

3. If you are programming in C++ you can use overloaded function J2K_Open().

Example

void *image = J2K_Open("test.j2k");

if(!image) printf("\n J2K-Codec error: %s.", J2K_getLastErrorStr());
else
{
   //Do some work here
   ...

   J2K_Close(image);
}

See also

J2K_Close()

Custom data sources
2004-2008 © Alex Saveliev