Compressing and Decompressing Buffers

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 Version 23.0.2024.3.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.