virtual L_INT LBitmapBase::ChangeCompression(nComp)
Compresses or decompresses a bitmap.
Flag that indicates the type of compression to use on the bitmap. Possible values are:
Value | Meaning |
---|---|
COMP_NONE | [0] No compression. This option can be used to decompress compressed or super compressed bitmaps. |
COMP_RLE | [1] 1-bit RLE compression. This compression is very fast and Lossless. For more information, refer to Speeding Up 1-Bit Documents. This is the same as passing TYPE_COMPRESSED to LBitmapBase::Allocate. |
COMP_SUPER | [2] Super compression. This is available for 1-bit, 8-bit, and 24-bit bitmaps only. The 24-bit and 8-bit compression is lossy, while the 1-bit compression is lossless. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64.
L_INT LBitmapBase__ChangeCompressionExample(LBitmapBase & Bitmap, L_TCHAR * pszFile)
{
L_INT nRet;
L_TCHAR szMessage[256];
nRet =Bitmap.Load(pszFile);
if(nRet !=SUCCESS)
return nRet;
if (Bitmap.GetBitsPerPixel() == 1 || Bitmap.GetBitsPerPixel() == 24)
{
wsprintf(szMessage, TEXT("BEFORE:\nImage Size: %ld bytes\nType: %s"),
Bitmap.GetMemSize(),
Bitmap.IsSuperCompressed() ?
TEXT("Super Compressed") : TEXT("Uncompressed"));
MessageBox(NULL, szMessage, TEXT("Changing Compression"), MB_OK);
nRet = Bitmap.ChangeCompression(Bitmap.IsSuperCompressed() ?
COMP_NONE : COMP_SUPER);
if(nRet == SUCCESS)
wsprintf(szMessage,
TEXT("AFTER:\nImage Size: %ld bytes\nType: %s"),
Bitmap.GetMemSize(),
Bitmap.IsSuperCompressed() ?
TEXT("Super Compressed") : TEXT("Uncompressed"));
else
{
wsprintf(szMessage, TEXT("Change Compressions Failed!"));
return nRet;
}
MessageBox(NULL, szMessage, TEXT("Changing Compression"), MB_OK);
}
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