Speeding Up 1-Bit Documents

(Document and Medical Imaging toolkits)

With the LEADTOOLS Document/Medical toolkit, you can improve the load and display performance of 1-bit images that are commonly used for document storage and FAX transmission.

LEADTOOLS achieves this speed improvement by letting you load an image in its RLE-compressed format, where you can work with it as if it were a fully-expanded bitmap. This not only speeds the throughput and storage, but also speeds up the display of large images that are scaled to fit a window. The display improvement is achieved because, internally, it is no longer necessary to decompress all lines of data to display the scaled-down image.

You can take advantage of this feature when loading files that are stored in the LEAD 1-Bit, TIFF Group 3 or Group 4, IOCA, WinFax, or raw FAX formats. To see whether a file can be loaded this way, you can call the L_FileInfo function, then check the Flags field in the FILEINFO structure to see if it has a value of FILEINFO_COMPRESSED.

To load a 1-bit image in its compressed format, you can specify a LOADFILE_COMPRESSED flag when calling any of the following functions:

L_LoadFile

L_LoadFileOffset

L_LoadMemory

L_StartFeedLoad

After an image is loaded, you can check the Flags.Compressed field of its BITMAPHANDLE structure to see if the bitmap is compressed. (LEADTOOLS functions maintain this flag, and you should not set it yourself.)

Once a compressed bitmap is loaded, you can use LEADTOOLS functions to access it just as you would any other 1-bit bitmap.

To toggle a 1-bit image between compressed and uncompressed form, call L_ToggleBitmapCompression.

The L_ChangeBitmapCompression function can be used to uncompress bitmaps, compress 1-bit bitmaps using RLE compression, or super compress 1-bit or 24-bit bitmaps.

However, if you create a bitmap yourself using L_CreateBitmap or L_AllocateBitmap, you must specify the storage type as TYPE_COMPRESSED. Also, if necessary, you can use the following low-level functions to access and manipulate the compressed bitmap data:

L_GetBitmapRowColCompressed

L_PutBitmapRowColCompressed

L_GetBitmapRowCompressed

L_PutBitmapRowCompressed

L_ExpandRow

L_CompressRow

If you use a FILEREADCALLBACK function when loading a file, the FILEREAD_COMPRESSED flag will be set in the function's uFlags parameter to indicate that the image data is compressed. In that case, if necessary, you can use the L_ExpandRow function to decompress data in the callback function. To implement the paint-while-load feature, you do not have to expand the data. Instead you can pass the number of lines as a negative value (-nLines) in the L_PaintDCBuffer function's nCount parameter.

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help