#include "ltwrappr.h"

L_INT LJp2FileFormat::ExtractFrames(pInFileName, pOutFileName, puFrames, uNumOfFrames)

L_TCHAR * pInFileName;

name of the input file

L_TCHAR * pOutFileName;

name of the output file

L_UINT32 * puFrames;

frame indices

L_UINT32 uNumOfFrames;

number of frames to be extracted

Extracts the frames that are specified by puFrames from the input file, and saves them into a new JPEG 2000 file contains only the extracted frames headers and codestreams directly not through decompressing/compressing process.  




Character string that contains the name of the JPEG 2000 file to extract frames from it.


Character string that contains the name of the new JPEG 2000 file that contains the extracted frames only.


Array of unsigned integers specifies the indices of the frames to be extracted from the input JPEG 2000 file. All indices shall be 0-based. If any frames index is out the frames number the function will return ERROR_INV_PARAMETER.


Number of frames to be extracted. This field specifies the size of puFrames array.



The function was successful.

< 1

An error occurred. Refer to Return Codes.


LJp2FileFormat::ExtractFrames extracts the specified frames from the input file and save them into a new JPEG 2000 file contains only the extracted frames headers and codestreams directly not through decompressing/compressing process so it saves processor time and memory. This function is very suitable to server application where multiple clients request specific frames of a JPEG 2000 file so instead of decompressing then compressing the frames this function copies only the needed frames data to generate them and saves the data into a new JPEG 2000 file.

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::ExtractFramesBuffer, LJp2FileFormat::ExtractFramesBufferMemory, LJp2FileFormat::AppendFrames, LJp2FileFormat::AppendGMLData, LJp2FileFormat::ReadBox, LJp2FileFormat::ReadGMLData, LJp2FileFormat::ReadFrames, LJp2FileFormat::FragmentJpxFile


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 extracts a frame from JPX file.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LJp2FileFormat__ExtractFramesExample(L_VOID) 
   LJp2FileFormat Engine; 
   L_JP2_FILEINFO Jp2FileInfo; 
   L_UINT32 puFrames[1]; 
   L_INT nRet = 0; 
   Jp2FileInfo.uStructSize = sizeof(L_JP2_FILEINFO); 
   if(Jp2FileInfo.MPEG7.uNumOfBoxes == 0) 
      return 0; 
   if(Jp2FileInfo.uNumOfFrames < 2) 
      return 0; 
      return 0; 
   /*Extract the second frame*/ 
   puFrames[0] = 1; 
   nRet = Engine.ExtractFrames(MAKE_IMAGE_PATH(TEXT("image1.jpx")), MAKE_IMAGE_PATH(TEXT("Test.jpx")), puFrames, 1); 
   if(nRet != SUCCESS) 
      return nRet; 
   /*Free File Info structure*/ 
   nRet = Engine.FreeFileInfo( &Jp2FileInfo); 
   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