FFComp
CCITT group IV-2d compressor

Prototype

Put the following prototype in the prototypes section of the application program header file:

int  ( __stdcall *pfnFFComp )( HGLOBAL, int, HANDLE, int, int );

Purpose

Compress a black & white image using coding scheme CCITT group 4-2d, and put the compressed data into a file.

Description and use

As you will see in the examples there is nothing special using this function. Just prepare the image in memory, prepare the file into which the data will be written, and call the function. The file is usually a TIFF file, the kind of file used in optical document storage and retrieval systems.

Specification

The image in memory should be black & white, and each pixel should be represented by one byte, being 0x00 the value for a black pixel and 0xFF the value for a white pixel.

This function, just like any other function in this DLL, has been developed with the aim to be integrated with the other functions in the DLL.

The compression algorythm is fully compliant with the CCITT blue book, volume VII, fascicle VII.3, recommendation T.6 for group 4 facsimile apparatus. The implementation is robust. Millions of images have been compressed using this routine.

The maximum image width is 2352 pixels (297 mm at 200 dpi), suitable for the width of A3 sized documents. To increment the image width I should recompile the DLL with a more large buffer. There is no limit in the image length.

Parameters
  • pointer to the memory area where the raster image to be compressed is accomodated
  • origin: set to 0 (other values not allowed)
  • file handle: handle to the file that will receive the compressed data; leave the file pointer positioned to the place where the compressed data should be written
  • image width in pixels/8 (max 294)
  • image length in lines (there is no limit)
Note: the image width in pixels should always be a multiple of 8; the application program should generate images in the frame buffer keeping in mind this recommendation, because this is a good practice. The overscan parameter provided in the
decompression routine has been provided to allow the decompression of images generated by application programs that do not agree with this practice.

Return value

No return value.

Application examples

See also

Notes

This routine is extremely fast. In an old PC with a 300 MHz clock it would take less than one tenth of a second to compress a letter size image.