#include "ltwrappr.h"

L_INT LJp2FileFormat::AppendFrames(pszFile, pComposite, nBitsPerPixel, nQFactor, pSaveOptions, pSaveCallBack, pUserData)

L_TCHAR * pszFile;

name of the file


frame information

L_INT nBitsPerPixel;

resulting frames pixel depth

L_INT nQFactor;

quality factor


pointer to optional extended save options

LFile::SaveFileCallBack pSaveCallBack;

optional callback function

L_VOID * pUserData;

pointer to more parameters for the callback

Appends new frames to the specified JPEG 2000 file.




Character string that contains the name of the JPEG 2000 file to append new frames.


Pointer to a composite structure that contains new frames information (color channels, opacity channels, pre-multiplied opacity channels, and compression type).


Resulting frames pixel depth. The available valid bits per pixel are 8, 12, 16, 24, 32, 48, and 64. If the value is zero, then each bitmap will be saved by its own bits per pixel but it shall be one of the above values.


Quality factor. This value determines the degree of loss in the compression process. Possible values are from 0 to 255. Zero (0) represents lossless compression. Values between 1 and 255 are interpreted as a compression ratio.


Pointer to optional extended save options. Pass NULL to use the default save options.


Optional callback function for additional processing.


If you do not provide a callback function, pass NULL.


If you provide a callback function, use the function pointer as the value of this parameter.


The callback function must adhere to the syntax described in LFile::SaveFileCallBack.


Void pointer you can use to pass one or more additional parameters used by the callback function.


To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.


If additional parameters are not needed, pass NULL.



The function was successful.

< 1

An error occurred. Refer to Return Codes.


LJp2FileFormat::AppendFrames appends new frames to already existing JPEG 2000 file. The new frames codestreams are determined by pComposite. pComposite determines the channels of this layers. If the channels bitmap is not allocated, the channel does not exist. The color bitmap must be allocated in all frames. If any color bitmap is not allocated, the function will return ERROR_NO_BITMAP. All of the engines boxes will be reset.

Required DLLs and Libraries


For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.


Win32, x64.

See Also


LJp2FileFormat::AppendBoxes, LJp2FileFormat::AppendBoxesMemory , LJp2FileFormat::AppendFramesMemory, LJp2FileFormat::AppendGMLDataMemory, LJp2FileFormat::ReadBox, LJp2FileFormat::ReadBoxMemory


Implementing JPEG 2000 Features


Raster Image Functions: Working with JPEG 2000


Programming with JPX Features


JPX File Comments


Raster Image Functions: Working with JPX


This example appends an image to already existing JPEG 2000 file.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LJp2FileFormat__AppendFramesExample(pBITMAPHANDLE pBitmap) 
   LJp2FileFormat Engine; 
   L_INT  nRet; 
   L_JP2_JPXBITMAPS pBitmaps[1] = {0}; 
   L_JP2_JPXCOMPOSITE Composite; 
   pBitmaps[0].uStructSize = sizeof(L_JP2_JPXBITMAPS); 
   pBitmaps[0].ColorBitmap = *pBitmap; 
   pBitmaps[0].eColorFormat = LEADJP2_J2K; 
   Composite.uStructSize = sizeof(L_JP2_JPXCOMPOSITE); 
   Composite.pBitmaps = pBitmaps; 
   Composite.uNumOfBitmaps = 1; 
   /*Append frames to a JPX file*/ 
   nRet = Engine.AppendFrames(MAKE_IMAGE_PATH(TEXT("image1.jpx")),&Composite,24,5,NULL,NULL,NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help