@compress - Image Compression/Decompression Coders;/


NAME



1compress - Image Compression/Decompression Coders




(

SYNOPSIS



)ASCII85Encode(code,file)

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

-status=GIFDecodeImage(image)

7status=GIFEncodeImage(image,data_size)

>status=Huffman2DEncodeImage(image_info,image)

1status=HuffmanDecodeImage(image)

<status=HuffmanEncodeImage(image_info,image)

Astatus=LZWEncodeImage(file,number_pixels,pixels)

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

Lstatus=PICTDecodeImage(image,bytes_per_line,bits_per_pixel)

>status=PICTEncodeImage(image,scanline,pixels)

:status=PackbitsDecodeImage(image,channel)

Fstatus=PackbitsEncodeImage(file,number_pixels,pixels)

3status=RunlengthDecodeImage(image)

2count=RunlengthEncodeImage(image)

,SetRunlengthEncoder(packet)

3SetRunlengthPackets(image,packets)

Jstatus=ZLIBEncodeImage(file,number_pixels,quality,pixels)




B

FUNCTION DESCRIPTIONS






2

ASCII85Encode



HMethod ASCII85Encode encodes data in ASCII base-85 format. ASCII base-85Iencoding 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:

3
code:


-a binary unsigned char to encode to ASCII 85.

file:


/write the encoded ASCII character to this file.






4

BMPDecodeImage



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

,The format of the BMPDecodeImage routine is:

V

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


(A description of each parameter follows:

status:


EMethod BMPDecodeImage returns True if all the pixels are uncompressedwithout error, otherwise False.

file:


IThe address of a structure of type FILE. BMP encoded pixels are read from this file.%

compression:


DA value of 1 means the compressed pixels are runlength encoded for a7256-color bitmap. A value of 2 means a 16-color bitmap.(

number_columns:


IAn integer value that is the number of columns or width in pixels of your source image.%

number_rows:


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

pixels:


JThe address of a byte (8 bits) array of pixel data created by the decodingprocess.






4

BMPEncodeImage



IMethod BMPEncodeImage compresses pixels using a runlength encoded format.

,The format of the BMPEncodeImage routine is:

A

    status=BMPEncodeImage(pixels,number_columns,number_rows,




      compressed_pixels)


(A description of each parameter follows:

status:


JMethod BMPEncodeImage returns the number of bytes in the runlength encodedcompress_pixels array.

pixels:


AThe address of a byte (8 bits) array of pixel data created by thecompression process.(

number_columns:


IAn integer value that is the number of columns or width in pixels of your source image.%

number_rows:


GAn integer value that is the number of rows or heigth in pixels of your source image.+

compressed_pixels:


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






4

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:


EMethod GIFDecodeImage returns True if all the pixels are uncompressedwithout error, otherwise False.

image:


)The address of a structure of type Image.






4

GIFEncodeImage



9Method GIFEncodeImage compresses an image via GIF-coding.

,The format of the GIFEncodeImage routine is:

3

        status=GIFEncodeImage(image,data_size)


(A description of each parameter follows:

status:


KMethod GIFEncodeImage returns True if all the pixels are compressed withouterror, otherwise False.

image:


)The address of a structure of type Image.






<

HuffmanDecodeImage



CMethod HuffmanDecodeImage uncompresses an image via Huffman-coding.

0The format of the HuffmanDecodeImage routine is:

-

        status=HuffmanDecodeImage(image)


(A description of each parameter follows:

status:


GMethod HuffmanDecodeImage returns True if all the pixels are compressedwithout error, otherwise False.

image:


)The address of a structure of type Image.






<

HuffmanEncodeImage



AMethod HuffmanEncodeImage compresses an image via Huffman-coding.

0The format of the HuffmanEncodeImage routine is:

8

        status=HuffmanEncodeImage(image_info,image)


(A description of each parameter follows:

status:


GMethod HuffmanEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.$

image_info:


.Specifies a pointer to an ImageInfo structure.

image:


)The address of a structure of type Image.






@

Huffman2DEncodeImage



CMethod Huffman2DEncodeImage compresses an image via two-dimensionalHuffman-coding.

2The format of the Huffman2DEncodeImage routine is:

:

        status=Huffman2DEncodeImage(image_info,image)


(A description of each parameter follows:

status:


IMethod Huffman2DEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.$

image_info:


.Specifies a pointer to an ImageInfo structure.

image:


)The address of a structure of type Image.






4

LZWEncodeImage



DMethod LZWEncodeImage compresses an image via LZW-coding specific toKPostscript 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,number_pixels,pixels)


(A description of each parameter follows:

status:


KMethod LZWEncodeImage returns True if all the pixels are compressed withouterror, otherwise False.

file:


JThe address of a structure of type FILE. LZW encoded pixels are written to this file.'

number_pixels:


EAn unsigned interger that specifies the number of pixels to compress.

pixels:


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






>

PackbitsDecodeImage



GMethod PackbitsDecodeImage uncompresses an image via Macintosh Packbits6encoding specific to the Adobe Photoshop image format.

1The format of the PackbitsDecodeImage routine is:

6

        status=PackbitsDecodeImage(image,channel)


(A description of each parameter follows:

status:


HMethod PackbitsDecodeImage 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.!

channel:


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






>

PackbitsEncodeImage



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

1The format of the PackbitsEncodeImage routine is:

B

        status=PackbitsEncodeImage(file,number_pixels,pixels)


(A description of each parameter follows:

status:


HMethod PackbitsEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.

file:


JThe address of a structure of type FILE. LZW encoded pixels are written to this file.'

number_pixels:


DAn unsigned integer that specifies the number of pixels to compress.

pixels:


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






4

PCDDecodeImage



@Method PCDDecodeImage recovers the Huffman encoded luminance andchrominance deltas.

,The format of the PCDDecodeImage routine is:

>

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


(A description of each parameter follows:

status:


JMethod PCDDecodeImage returns True if all the deltas are recovered withouterror, otherwise False.

image:


)The address of a structure of type Image.

luma:


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






6

PICTDecodeImage



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

-The format of the PICTDecodeImage routine is:

H

        status=PICTDecodeImage(image,bytes_per_line,bits_per_pixel)


(A description of each parameter follows:

status:


FMethod PICTDecodeImage returns True if all the pixels are uncompressedwithout 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.






6

PICTEncodeImage



KMethod PICTEncodeImage compresses an image via Macintosh pack bits encodingfor Macintosh PICT images.

-The format of the PICTEncodeImage routine is:

:

        status=PICTEncodeImage(image,scanline,pixels)


(A description of each parameter follows:

status:


DMethod PICTEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.

image:


)The address of a structure of type Image."

scanline:


,A pointer to an array of characters to pack.

pixels:


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






@

RunlengthDecodeImage



@Method RunlengthDecodeImage unpacks the packed image pixels intoFrunlength-encoded pixel packets. The packed image pixel memory is thenfreed.

2The format of the RunlengthDecodeImage routine is:

/

        status=RunlengthDecodeImage(image)


(A description of each parameter follows:

status:


IMethod 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



JMethod RunlengthEncodeImage packs the runlength-encoded pixel packets intothe minimum number of bytes.

2The format of the RunlengthEncodeImage routine is:

.

        count=RunlengthEncodeImage(image)


(A description of each parameter follows:

status:


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

2The 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.

2The 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.






4

SUNDecodeImage



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

,The format of the SUNDecodeImage routine is:

L

    status=SUNDecodeImage(compressed_pixels,number_columns,number_rows,




      pixels)


(A description of each parameter follows:

status:


EMethod SUNDecodeImage returns True if all the pixels are uncompressedwithout error, otherwise False.+

compressed_pixels:


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

pixels:


AThe address of a byte (8 bits) array of pixel data created by theIuncompression process. The number of bytes in this array must be at leastJequal to the number columns times the number of rows of the source pixels.(

number_columns:


IAn integer value that is the number of columns or width in pixels of your source image.%

number_rows:


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






6

ZLIBEncodeImage



FMethod ZLIBEncodeImage compresses an image via ZLIB-coding specific toKPostscript 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:

F

        status=ZLIBEncodeImage(file,number_pixels,quality,pixels)


(A description of each parameter follows:

status:


DMethod ZLIBEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.

file:


KThe address of a structure of type FILE. ZLIB encoded pixels are written to this file.'

number_pixels:


DAn unsigned integer that specifies the number of pixels to compress.!

quality:


the compression level (0-100).

pixels:


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