NAME

compress - Image Compression/Decompression Coders


SYNOPSIS

ASCII85Encode(code,file)

status=GIFDecodeImage(image)

status=GIFEncodeImage(image,data_size)

status=HuffmanDecodeImage(image)

status=HuffmanEncodeImage(image_info,image)

status=LZWEncodeImage(file,pixels,number_pixels)

status=PCDDecodeImage(image,luma,chroma1,chroma2)

status=PICTEncodeImage(image,scanline,packbits)

status=PackbitsEncodeImage(file,pixels,number_pixels)

status=RunlengthDecodeImage(image)

count=RunlengthEncodeImage(image)


FUNCTION DESCRIPTIONS


ASCII85Encode

Function ASCII85Encode encodes data in ASCII base-85 format. ASCII base-85 encoding produces five ASCII printing characters from every four bytes of binary data.

The format of the ASCII85Encode routine is:

        ASCII85Encode(code,file)

A description of each parameter follows:

o code:
a binary unsigned char to encode to ASCII 85.

o file:
write the encoded ASCII character to this file.


BMPDecodeImage

Function BMPDecodeImage unpacks the packed image pixels into runlength-encoded pixel packets.

The format of the BMPDecodeImage routine is:

    status=BMPDecodeImage(compressed_pixels,pixels,compression,

      number_columns,number_rows)

A description of each parameter follows:

o status:
Function BMPDecodeImage returns True if all the pixels are uncompressed without error, otherwise False.

o compressed_pixels:
The address of a byte (8 bits) array of compressed pixel data.

o pixels:
The address of a byte (8 bits) array of pixel data created by the decoding process.

o compression:
A value of 1 means the compressed pixels are runlength encoded for a 256-color bitmap. A value of 2 means a 16-color bitmap.

o number_columns:
An integer value that is the number of columns or width in pixels of your source image.

o number_rows:
An integer value that is the number of rows or heigth in pixels of your source image.


BMPEncodeImage

Function BMPEncodeImage compresses pixels using a runlength encoded format.

The format of the BMPEncodeImage routine is:

    status=BMPEncodeImage(pixels,compressed_pixels,number_columns,

      number_rows)

A description of each parameter follows:

o status:
Function BMPEncodeImage returns the number of bytes in the runlength encoded compress_pixels array.

o pixels:
The address of a byte (8 bits) array of pixel data created by the compression process.

o compressed_pixels:
The address of a byte (8 bits) array of compressed pixel data.

o number_columns:
An integer value that is the number of columns or width in pixels of your source image.

o number_rows:
An integer value that is the number of rows or heigth in pixels of your source image.


GIFDecodeImage

Function GIFDecodeImage uncompresses an image via GIF-coding.

The format of the GIFDecodeImage routine is:

        status=GIFDecodeImage(image)

A description of each parameter follows:

o status:
Function GIFDecodeImage returns True if all the pixels are uncompressed without error, otherwise False.

o image:
The address of a structure of type Image.


GIFEncodeImage

Function GIFEncodeImage compresses an image via GIF-coding.

The format of the GIFEncodeImage routine is:

        status=GIFEncodeImage(image,data_size)

A description of each parameter follows:

o status:
Function GIFEncodeImage returns True if all the pixels are compressed without error, otherwise False.

o image:
The address of a structure of type Image.


HuffmanDecodeImage

Function HuffmanDecodeImage uncompresses an image via Huffman-coding.

The format of the HuffmanDecodeImage routine is:

        status=HuffmanDecodeImage(image)

A description of each parameter follows:

o status:
Function HuffmanDecodeImage returns True if all the pixels are compressed without error, otherwise False.

o image:
The address of a structure of type Image.


HuffmanEncodeImage

Function HuffmanEncodeImage compresses an image via Huffman-coding.

The format of the HuffmanEncodeImage routine is:

        status=HuffmanEncodeImage(image_info,image)

A description of each parameter follows:

o status:
Function HuffmanEncodeImage returns True if all the pixels are compressed without error, otherwise False.

o image_info:
Specifies a pointer to an ImageInfo structure.

o image:
The address of a structure of type Image.


LZWEncodeImage

Function LZWEncodeImage compresses an image via LZW-coding specific to Postscript Level II or Portable Document Format. To ensure portability, the binary LZW bytes are encoded as ASCII base-85.

The format of the LZWEncodeImage routine is:

        status=LZWEncodeImage(file,pixels,number_pixels)

A description of each parameter follows:

o status:
Function LZWEncodeImage returns True if all the pixels are compressed without error, otherwise False.

o file:
The address of a structure of type FILE. LZW encoded pixels are written to this file.

o pixels:
The address of an unsigned array of characters containing the pixels to compress.

o number_pixels:
An unsigned interger that specifies the number of pixels to compress.


PackbitsEncodeImage

Function PackbitsEncodeImage compresses an image via Macintosh Packbits encoding specific to Postscript Level II or Portable Document Format. To ensure portability, the binary Packbits bytes are encoded as ASCII Base-85.

The format of the PackbitsEncodeImage routine is:

        status=PackbitsEncodeImage(file,pixels,number_pixels)

A description of each parameter follows:

o status:
Function PackbitsEncodeImage returns True if all the pixels are compressed without error, otherwise False.

o file:
The address of a structure of type FILE. LZW encoded pixels are written to this file.

o pixels:
The address of an unsigned array of characters containing the pixels to compress.

o number_pixels:
An unsigned interger that specifies the number of pixels to compress.


PCDDecodeImage

Function PCDDecodeImage recovers the Huffman encoded luminance and chrominance deltas.

The format of the PCDDecodeImage routine is:

        status=PCDDecodeImage(image,luma,chroma1,chroma2)

A description of each parameter follows:

o status:
Function PCDDecodeImage returns True if all the deltas are recovered without error, otherwise False.

o image:
The address of a structure of type Image.

o luma:
The address of a character buffer that contains the luminance information.

o chroma1:
The address of a character buffer that contains the chrominance information.

o chroma2:
The address of a character buffer that contains the chrominance information.


PICTEncodeImage

Function PICTEncodeImage compresses an image via Macintosh pack bits encoding for Macintosh PICT images.

The format of the PICTEncodeImage routine is:

        status=PICTEncodeImage(image,scanline,packbits)

A description of each parameter follows:

o status:
Function PICTEncodeImage returns True if all the pixels are compressed without error, otherwise False.

o image:
The address of a structure of type Image.

o scanline:
A pointer to an array of characters to pack.

o packbits:
A pointer to an array of characters where the packed characters are stored.


RunlengthDecodeImage

Function RunlengthDecodeImage unpacks the packed image pixels into runlength-encoded pixel packets. The packed image pixel memory is then freed.

The format of the RunlengthDecodeImage routine is:

        status=RunlengthDecodeImage(image)

A description of each parameter follows:

o status:
Function RunlengthDecodeImage return True if the image is decoded. False is returned if there is an error occurs.

o image:
The address of a structure of type Image.


RunlengthEncodeImage

Function RunlengthEncodeImage packs the runlength-encoded pixel packets into the minimum number of bytes.

The format of the RunlengthEncodeImage routine is:

        count=RunlengthEncodeImage(image)

A description of each parameter follows:

o status:
Function RunlengthEncodeImage return the number of bytes the image consumes. Zero is returned if an error occurs.

o image:
The address of a structure of type Image.


SUNDecodeImage

Function SUNDecodeImage unpacks the packed image pixels into runlength-encoded pixel packets.

The format of the SUNDecodeImage routine is:

    status=SUNDecodeImage(compressed_pixels,pixels,number_columns,

      number_rows)

A description of each parameter follows:

o status:
Function SUNDecodeImage returns True if all the pixels are uncompressed without error, otherwise False.

o compressed_pixels:
The address of a byte (8 bits) array of compressed pixel data.

o pixels:
The address of a byte (8 bits) array of pixel data created by the uncompression process. The number of bytes in this array must be at least equal to the number columns times the number of rows of the source pixels.

o number_columns:
An integer value that is the number of columns or width in pixels of your source image.

o number_rows:
An integer value that is the number of rows or heigth in pixels of your source image.