#include "l_bitmap.h"
L_LTJP2_API L_INT EXT_FUNCTION L_Jp2ExtractFramesBufferMemory(hJp2, pBuffer, uBufferSize, lpBuffer, puBufferSize, puFrames, uNumOfFrames)
Extracts the frames that are specified by puFrames
from the JPEG 2000 file in memory and save them into a new JPEG 2000 file in a memory buffer that is allocated by the function contains only the extracted frames headers and codestreams directly not through decompressing/compressing process.
JPEG 2000 engine handle that was created by the L_Jp2Create function.
Pointer to the JPEG 2000 file in memory to extract frames from it.
Size of the in memory (in bytes).
Pointer to a pointer to be updated with an array of bytes that contains a JPEG 2000 file with extracted frames only. You must free this buffer by calling the Windows GlobalFree() function.
Address of a variable to be updated with the size of the memory buffer in bytes.
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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
L_Jp2ExtractFramesBufferMemory extracts the specified frames from the JPEG 2000 file in memory and save them into a new JPEG 2000 file in a memory buffer that is allocated by the function 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 in a memory buffer.
Required DLLs and Libraries
Win32, x64.
This example extracts a frame from JPX file.
L_INT Jp2ExtractFramesBufferMemoryExample(L_UINT8* pFileBuffer, L_SIZE_T uFileSize, L_UINT8** lpFrameBuffer, L_SIZE_T * puFrameSize)
{
L_HJP2 hEngine;
L_JP2_FILEINFO Jp2FileInfo;
L_UINT32 puFrames[1];
*lpFrameBuffer = NULL;
*puFrameSize = 0;
/*Create JPEG 2000 engine handle*/
hEngine = L_Jp2Create();
Jp2FileInfo.uStructSize = sizeof(L_JP2_FILEINFO);
L_Jp2GetFileInfoMemory(hEngine, pFileBuffer, uFileSize, &Jp2FileInfo);
/*Extract the second frame*/
puFrames[0] = 0;
L_Jp2ExtractFramesBufferMemory(hEngine, pFileBuffer, uFileSize, lpFrameBuffer, puFrameSize, puFrames, 1);
/*Free File Info structure*/
L_Jp2FreeFileInfo(hEngine, &Jp2FileInfo);
/*Destroy engine handle*/
L_Jp2Destroy(hEngine);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document