|
|
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 |
Calculating buffer size If you will allocate the buffer for resulting image yourself, you need to know, how to calculate its size. Since the current version of J2K-Codec supports only 8-bit components, the formula is very simple: size = Width × Height × ComponentsNotes 1. Sometimes it is useful to allocate 4 bytes per each pixel even if there is only 3 components in the image (RGB). This is the default behavior of J2K-Codec when it allocates the buffer itself. Working with 4-bpp buffers is usually faster. But don't forget to pass "bpp=4" option into the decode function if you will allocate 4 bytes-per-pixel buffer! 2. The same formula is used if you are getting a particular resolution from the image. In this case, Width and Height will be the width and height of the resolution, obtained from J2K_GetResolutionDimensions(). Example
int width, height, components; J2K_GetInfo() List of options |
| 2004-2006 © Alex Saveliev |