L_INT EXT_FUNCTION LJp2FileFormat::SaveList(pszFile, hList, eFormat, nBitsPerPixel, nQFactor, pSaveOptions, pSaveCallBack, pUserData)
Saves a list of bitmaps, to a file in any supported JPEG 2000 format.
Character string that contains the name of the JPEG 2000 file.
Handle to the list of bitmaps.
Output JPEG 2000 file format.
Resulting files pixel depth. Possible values are: 8, 12, 16, 24, 32, 48, 64, and 0. Zero [0] means that each bitmap will be saved with its bits per pixel value, if that value is equal to one of the possible values (8, 12, 16, 24, 32, 48, or 64). If it is not one of the possible values, it will return: ERROR_J2K_UNSUPPORTED.
Quality factor. This Quality Factor 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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
LJp2FileFormat::SaveList saves a list of bitmaps, to a file in any supported JPEG 2000 format. However, note that the JPEG 2000 part 1 (JP2) file format does not support multiple codestreams. Therefore, if eFormat passes JP2, only the first bitmap in the list will be saved. All of the currently-set engines boxes will also be saved in this file.
Win32, x64.
This example saves/loads bitmap list in JPEG 2000 file format
L_INT LJp2FileFormat__SaveListExample(L_UINT8 * pXMLData, L_SIZE_T uSize)
{
LJp2FileFormat Engine;
L_INT nRet;
HBITMAPLIST hList;
L_JP2_XML_BOX XMLBox;
pL_JP2_MPEG7_BOX pMPEG7Box;
L_UINT uNumOfMPEG7;
/*Load an image*/
nRet = Engine.ReadList(MAKE_IMAGE_PATH(TEXT("image1.jpx")),&hList,0,ORDER_BGR,NULL, NULL, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
/*Read MPEG7 boxes*/
nRet = Engine.GetBoxes( L_JPXB_MPEG7, (L_VOID**)&pMPEG7Box,&uNumOfMPEG7);
if(nRet != SUCCESS)
return nRet;
/*Reset all engine boxes*/
nRet = Engine.ResetBoxes();
if(nRet != SUCCESS)
return nRet;
/*Set JPX Engine Boxes*/
if(uNumOfMPEG7)
{
nRet = Engine.SetBoxes(L_JPXB_MPEG7,pMPEG7Box,uNumOfMPEG7);
if(nRet != SUCCESS)
return nRet;
}
/*Create an XML box*/
XMLBox.uStructSize = sizeof(L_JP2_XML_BOX);
XMLBox.pData = pXMLData;
XMLBox.uDataSize = uSize;
/*Set XML box of JPX engine*/
nRet = Engine.SetBoxes(L_JPXB_XML,&XMLBox,1);
if(nRet != SUCCESS)
return nRet;
/*Save the image in JPx format*/
nRet = Engine.SaveList(MAKE_IMAGE_PATH(TEXT("Test.jpx")), hList,LEADJP2_JPX, 24, 5,NULL, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
/*Free MPEG7 boxes*/
if(uNumOfMPEG7)
Engine.FreeBoxes( L_JPXB_MPEG7, pMPEG7Box, uNumOfMPEG7);
LBitmapList BitmapList;
BitmapList.SetHandle(hList);
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