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=PICTDecodeImage(image,bytes_per_line,bits_per_pixel)

status=PICTEncodeImage(image,scanline,pixels)

PackbitsDecodeImage(image,channel)

status=PackbitsEncodeImage(file,pixels,number_pixels)

status=RunlengthDecodeImage(image)

count=RunlengthEncodeImage(image)

SetRunlengthEncoder(packet)

SetRunlengthPackets(image,packets)

status=ZLIBEncodeImage(file,pixels,number_pixels)


FUNCTION DESCRIPTIONS


ASCII85Encode

Method 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

Method 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:

Method 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

Method 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:

Method 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

Method GIFDecodeImage uncompresses an image via GIF-coding.

The format of the GIFDecodeImage routine is:

        status=GIFDecodeImage(image)

A description of each parameter follows:

status:

Method GIFDecodeImage returns True if all the pixels are uncompressed without error, otherwise False.

image:

The address of a structure of type Image.


GIFEncodeImage

Method 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:

Method GIFEncodeImage returns True if all the pixels are compressed without error, otherwise False.

image:

The address of a structure of type Image.


HuffmanDecodeImage

Method HuffmanDecodeImage uncompresses an image via Huffman-coding.

The format of the HuffmanDecodeImage routine is:

        status=HuffmanDecodeImage(image)

A description of each parameter follows:

status:

Method HuffmanDecodeImage returns True if all the pixels are compressed without error, otherwise False.

image:

The address of a structure of type Image.


HuffmanEncodeImage

Method 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:

Method 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

Method 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:

Method 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

Method 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:

Method 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.


PackbitsDecodeImage

Method PackbitsDecodeImage uncompresses an image via Macintosh Packbits encoding specific to the Adobe Photoshop image format.

The format of the PackbitsDecodeImage routine is:

        PackbitsDecodeImage(image,channel)

A description of each parameter follows:

image:

The address of a structure of type Image.

channel:

Specifies which channel: red, green, blue, or index to decode the pixel values into.


PackbitsEncodeImage

Method 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:

Method 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 integer that specifies the number of pixels to compress.


PCDDecodeImage

Method 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:

Method 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.


PICTDecodeImage

Method PICTDecodeImage decompresses an image via Macintosh pack bits decoding for Macintosh PICT images.

The format of the PICTDecodeImage routine is:

        status=PICTDecodeImage(image,bytes_per_line,bits_per_pixel)

A description of each parameter follows:

status:

Method PICTDecodeImage returns True if all the pixels are uncompressed without error, otherwise False.

image:

The address of a structure of type Image.

bytes_per_line:

This integer identifies the number of bytes in a scanline.

bits_per_pixel:

The number of bits in a pixel.


PICTEncodeImage

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

The format of the PICTEncodeImage routine is:

        status=PICTEncodeImage(image,scanline,pixels)

A description of each parameter follows:

status:

Method 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.

pixels:

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


RunlengthDecodeImage

Method 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:

Method 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

Method 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:

Method 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.


SetRunlengthEncoder

Method SetRunlengthEncoder initializes the runlength encoder.

The format of the SetRunlengthEncoder function is:

        SetRunlengthEncoder(packet)

A description of each parameter follows:

packet:

Specifies a RunlengthPacket type.


SetRunlengthPackets

Method SetRunlengthPackets initializes the runlength encoder.

The format of the SetRunlengthPackets function is:

        SetRunlengthPackets(image,packets)

A description of each parameter follows:

image:

The address of a structure of type Image.

packets:

The number of runlength packets.


SUNDecodeImage

Method 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:

Method 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

Method 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:

Method 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 integer that specifies the number of pixels to compress.

quality:

the compression level (0-100).