Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

Compressing and Decompressing Buffers

Show in webframe

LEADTOOLS provides several functions for compressing and decompressing images in buffers.

To begin the compression process, the L_StartCompressBuffer function must be called. This function initializes the compression engine, sets the characteristics such as compression factor and output type for the compression, and establishes the COMPBUFFCALLBACK callback that will handle the compressed data. Compression is actually carried out by calling L_CompressBuffer. Once the L_CompressBuffer function is called, the COMPBUFFCALLBACK function is called each time the buffer is filled with compressed data, or when the compression is complete. When compression is completed, the data variables and buffers allocated by the L_StartCompressBuffer and L_CompressBuffer functions should be freed by calling L_EndCompressBuffer.

To begin the decompression process, the L_StartDecompressBuffer function must be called. This function 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 function, refer to the STARTDECOMPRESSDATA structure. For each strip or tile to be decompressed, the L_DecompressBuffer function must be called. When decompression is completed, data variables and buffers allocated by the L_StartDecompressBuffer and L_DecompressBuffer functions should be freed by calling L_StopDecompressBuffer.

TWAIN buffer transfers can return data in raw compressed form. These functions provide a means of decompressing this data. Consequently, these functions only work for certain file types. These file types and the corresponding TWAIN constant are given below:

LEAD file constant

TWAIN constant

FILE_JPEG

TWCP_JPEG

FILE_RAW_RLE4

TWCP_RLE4

FILE_RAW_RLE8

TWCP_RLE8

FILE_RAW_BITFIELDS

TWCP_BITFIELDS

FILE_RAW_PACKBITS

TWCP_PACKBITS

FILE_RAW_CCITT

TWCP_GROUP31D

FILE_FAX_G3_1D

TWCP_GROUP31DEOL

FILE_FAX_G3_2D

TWCP_GROUP32D

FILE_FAX_G4

TWCP_GROUP4

(Document and Medical Imaging toolkits)

LEADTOOLS provides functionality for compressing and decompressing ABIC images in buffers.

To begin the compression process, the L_EncodeABIC function must be called. This compresses the input raw data to 1-bit bi-level or 4-bit grayscale data using the ABIC encoder.

To begin the decompression process, the L_DecodeABIC function must be called. This function decompresses the input 1-bit bi-level or 4-bit grayscale ABIC raw data using the ABIC decoder.

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.