NAME

compress - Image Compression/Decompression Coders


SYNOPSIS

ASCII85Encode(code,file)

status=BMPDecodeImage(file,pixels,compression,number_columns,number_rows)

status=GIFDecodeImage(image)

status=GIFEncodeImage(image,data_size)

status=Huffman2DEncodeImage(image_info,image)

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)

status=ZLIBEncodeImage(file,pixels,number_pixels)


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:

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

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(file,pixels,compression,number_columns,number_rows)

A description of each parameter follows:

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

file:
The address of a structure of type FILE. BMP encoded pixels are read from this file.

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

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.

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

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:

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

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

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

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

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:

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

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:

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

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:

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

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:

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

image_info:
Specifies a pointer to an ImageInfo structure.

image:
The address of a structure of type Image.


Huffman2DEncodeImage

Function Huffman2DEncodeImage compresses an image via two-dimensional Huffman-coding.

The format of the Huffman2DEncodeImage routine is:

        status=Huffman2DEncodeImage(image_info,image)

A description of each parameter follows:

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

image_info:
Specifies a pointer to an ImageInfo structure.

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:

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

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

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

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:

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

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

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

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:

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

image:
The address of a structure of type Image.

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

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

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:

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

image:
The address of a structure of type Image.

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

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:

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

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:

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

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:

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

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

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.

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

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


ZLIBEncodeImage

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

The format of the ZLIBEncodeImage routine is:

        status=ZLIBEncodeImage(file,pixels,number_pixels)

A description of each parameter follows:

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

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

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

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