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_GetInfoEx


Use this function to get extended information about J2K image.

int J2K_GetInfoEx(void *image, J2K_Info *info);


Parameters

image
A pointer, obtained from J2K_Open().

info
A pointer to a J2K_Info structure:
typedef struct
{
  int Version;        // J2K-Codec version as returned by J2K_getVersion()
  int Width, Height;  // Width and height of the image in pixels
  int Components;     // The number of components in the image
  int FileType;       // The image file type (0 = Lossy J2K, 1 = Lossy JP2, 2 = Lossless J2K, 3 = Lossless JP2).
  int hTiles, vTiles; // The number of tiles in horizontal and vertical directions
  int Precision;      // Component precision in bits. All components must have the same precision.
}
J2K_Info;
Return value

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

Notes

The main reason to use J2K_GetInfoEx() is to obtain the number of horizontal and vertical tiles in the image for selective tiles decoding.

Example

J2K_Info info;

int j2k_err = J2K_GetInfoEx(image, &info;);

if(j2k_err != J2KERR_SUCCESS) printf("\n J2K-Codec error: %s.", J2K_getErrorStr(j2k_err));
else
{
   printf("\n %s Image info:", (info.FileType&1) ? "JP2" : "J2K");

   printf("\n  - %s compression", (info.FileType&2) ? "Lossless" : "Lossy");

   printf("\n  - %ux%u, %u component(s)", info.Width, info.Height, info.Components);

   printf("\n  - %ux%u tiles", info.hTiles, info.vTiles);
}

See also

J2K_Open()

J2K_GetInfo()
2004-2008 © Alex Saveliev