LEADTOOLS provides several methods/classes for compressing and decompressing images in buffers.
To begin the compression process, the StartCompress method must be called. This method initializes the compression engine, sets the characteristics such as compression factor and output type for the compression. The CodecsCompressDataCallback delegate passed to the method will handle the compressed data. Compression is actually carried out by calling the Compress method Once the Compress method is called, the CompressData event is called each time the buffer is filled with compressed data, or when the compression is complete. When compression is completed, call the StopCompress method
To begin the decompression process, the StartDecompress method must be called. This method initializes the decompression engine and establishes characteristics of the decompression, such as whether strips or tiles will be decompressed, the format of the image, the view perspective, the load order, and where to place the decompressed image. For more information about the decompression characteristics set by this method, refer to the CodecsStartDecompressOptions class. For each strip or tile to be decompressed, the Decompress method must be called. When decompression is completed, call the StopDecompress method.
TWAIN buffer transfers can return data in raw compressed form. These methods provide a means of decompressing this data. Consequently, these methods only work for certain file types. These file types and the corresponding TWAIN constant are given below:
LEAD file constant |
Twain constant |
RasterImageFormat.Jpeg |
TwainCapabilityValue.CompressionJpeg |
RasterImageFormat.RawRle4 |
TwainCapabilityValue.CompressionRle4 |
RasterImageFormat.RawRle8 |
TwainCapabilityValue.CompressionRle8 |
RasterImageFormat.RawBitfields |
TwainCapabilityValue.CompressionBitfields |
RasterImageFormat.RawPackbits |
TwainCapabilityValue.CompressionPackbits |
RasterImageFormat.RawCcitt |
TwainCapabilityValue.CompressionGroup31D |
RasterImageFormat.FaxG31Dim |
TwainCapabilityValue.CompressionGroup31DEol |
RasterImageFormat.FaxG32Dim |
TwainCapabilityValue.CompressionGroup32D |
RasterImageFormat.FaxG4 |
TwainCapabilityValue.CompressionGroup4 |
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