<HTML>
<HEAD>
<TITLE>compress - Image Compression/Decompression Coders</TITLE>
<LINK REV="made" HREF="mailto:magick@wizards.dupont.com">
</HEAD>

<body background="../../images/background.png">

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A>
	<UL>

		<LI><A HREF="#ASCII85Encode">ASCII85Encode</A>
		<LI><A HREF="#HuffmanDecodeImage">HuffmanDecodeImage</A>
		<LI><A HREF="#HuffmanEncodeImage">HuffmanEncodeImage</A>
		<LI><A HREF="#Huffman2DEncodeImage">Huffman2DEncodeImage</A>
		<LI><A HREF="#LZWEncodeImage">LZWEncodeImage</A>
		<LI><A HREF="#PackbitsEncodeImage">PackbitsEncodeImage</A>
		<LI><A HREF="#RunlengthDecodeImage">RunlengthDecodeImage</A>
		<LI><A HREF="#RunlengthEncodeImage">RunlengthEncodeImage</A>
		<LI><A HREF="#SetRunlengthEncoder">SetRunlengthEncoder</A>
		<LI><A HREF="#SetRunlengthPackets">SetRunlengthPackets</A>
		<LI><A HREF="#ZLIBEncodeImage">ZLIBEncodeImage</A>
	</UL>

</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
compress - Image Compression/Decompression Coders

<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
unsigned int  <STRONG>Huffman2DEncodeImage</STRONG>( ImageInfo *image_info, Image <CODE>*image</CODE> );

<P>
unsigned int  <STRONG>HuffmanDecodeImage</STRONG>( Image <CODE>*image</CODE> );

<P>
unsigned int  <STRONG>HuffmanEncodeImage</STRONG>( const ImageInfo *image_info, Image <CODE>*image</CODE> );

<P>
unsigned int  <STRONG>LZWEncodeImage</STRONG>( Image *image, const unsigned int number_pixels, unsigned char
<CODE>*pixels</CODE> );

<P>
unsigned int  <STRONG>PackbitsEncodeImage</STRONG>( Image *image, const unsigned int number_pixels, unsigned char
<CODE>*pixels</CODE> );

<P>
unsigned int  <STRONG>RunlengthDecodeImage</STRONG>( Image <CODE>*image</CODE> );

<P>
unsigned int  <STRONG>RunlengthEncodeImage</STRONG>( Image <CODE>*image</CODE> );

<P>
<STRONG>SetRunlengthEncoder</STRONG>( packet );

<P>
<STRONG>SetRunlengthPackets</STRONG>( image, packets );

<P>
unsigned int  <STRONG>ZLIBEncodeImage</STRONG>( Image *image, const unsigned long number_pixels, const unsigned int
quality, unsigned char <CODE>*pixels</CODE> );

<P>
<HR>
<H1><A NAME="FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A></H1>
<P>
<HR>
<H2><A NAME="ASCII85Encode">ASCII85Encode</A></H2>
<P>
Method ASCII85Encode encodes data in 
<FONT SIZE=-1>ASCII</FONT> base-85 format. 
<FONT SIZE=-1>ASCII</FONT> base-85 encoding produces five 
<FONT SIZE=-1>ASCII</FONT> printing characters from every four bytes of binary data.


<P>
The format of the ASCII85Encode method is:

<P>
<PRE>    void Ascii85Initialize(void)
</PRE>
<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG><A NAME="item_o">code:</A></STRONG><DD>
<P>
a binary unsigned char to encode to 
<FONT SIZE=-1>ASCII</FONT> 85.

<p><dt><STRONG>file:</STRONG><DD>
<P>
write the encoded 
<FONT SIZE=-1>ASCII</FONT> character to this file.

</DL></DL>
<P>
<HR>
<H2><A NAME="HuffmanDecodeImage">HuffmanDecodeImage</A></H2>
<P>
Method HuffmanDecodeImage uncompresses an image via Huffman-coding.

<P>
The format of the HuffmanDecodeImage method is:

<blockquote>unsigned int HuffmanDecodeImage ( <A HREF="types/Image.html">Image</A> *image ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method HuffmanDecodeImage returns True if all the pixels are compressed
without error, otherwise False.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

</DL></DL>
<P>
<HR>
<H2><A NAME="HuffmanEncodeImage">HuffmanEncodeImage</A></H2>
<P>
Method HuffmanEncodeImage compresses an image via Huffman-coding.

<P>
The format of the HuffmanEncodeImage method is:

<blockquote>unsigned int HuffmanEncodeImage ( const <A HREF="types/ImageInfo.html">ImageInfo</A> *image_info, <A HREF="types/Image.html">Image</A> *image ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method HuffmanEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

<p><dt><STRONG>image_info:</STRONG><DD>
<P>
Specifies a pointer to an ImageInfo structure.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

</DL></DL>
<P>
<HR>
<H2><A NAME="Huffman2DEncodeImage">Huffman2DEncodeImage</A></H2>
<P>
Method Huffman2DEncodeImage compresses an image via two-dimensional
Huffman-coding.

<P>
The format of the Huffman2DEncodeImage method is:

<blockquote>unsigned int Huffman2DEncodeImage ( <A HREF="types/ImageInfo.html">ImageInfo</A> *image_info, <A HREF="types/Image.html">Image</A> *image ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method Huffman2DEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

<p><dt><STRONG>image_info:</STRONG><DD>
<P>
Specifies a pointer to an ImageInfo structure.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

</DL></DL>
<P>
<HR>
<H2><A NAME="LZWEncodeImage">LZWEncodeImage</A></H2>
<P>
Method LZWEncodeImage compresses an image via LZW-coding specific to Postscript Level 
<FONT SIZE=-1>II</FONT> or Portable Document Format. To ensure portability, the binary 
<FONT SIZE=-1>LZW</FONT> bytes are encoded as 
<FONT SIZE=-1>ASCII</FONT> base-85.


<P>
The format of the LZWEncodeImage method is:

<blockquote>unsigned int LZWEncodeImage ( <A HREF="types/Image.html">Image</A> *image, const unsigned int number_pixels, unsigned char *pixels ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method LZWEncodeImage returns True if all the pixels are compressed without
error, otherwise False.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

<p><dt><STRONG>number_pixels:</STRONG><DD>
<P>
An unsigned interger that specifies the number of pixels to compress.

<p><dt><STRONG>pixels:</STRONG><DD>
<P>
The address of an unsigned array of characters containing the pixels to
compress.

</DL></DL>
<P>
<HR>
<H2><A NAME="PackbitsEncodeImage">PackbitsEncodeImage</A></H2>
<P>
Method PackbitsEncodeImage compresses an image via Macintosh Packbits encoding specific to Postscript Level 
<FONT SIZE=-1>II</FONT> or Portable Document Format. To ensure portability, the binary Packbits bytes are encoded as 
<FONT SIZE=-1>ASCII</FONT> Base-85.


<P>
The format of the PackbitsEncodeImage method is:

<blockquote>unsigned int PackbitsEncodeImage ( <A HREF="types/Image.html">Image</A> *image, const unsigned int number_pixels, unsigned char *pixels ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method PackbitsEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

<p><dt><STRONG>number_pixels:</STRONG><DD>
<P>
An unsigned integer that specifies the number of pixels to compress.

<p><dt><STRONG>pixels:</STRONG><DD>
<P>
The address of an unsigned array of characters containing the pixels to
compress.

</DL></DL>
<P>
<HR>
<H2><A NAME="RunlengthDecodeImage">RunlengthDecodeImage</A></H2>
<P>
Method RunlengthDecodeImage unpacks the packed image pixels into
runlength-encoded pixel packets. The packed image pixel memory is then
freed.

<P>
The format of the RunlengthDecodeImage method is:

<blockquote>unsigned int RunlengthDecodeImage ( <A HREF="types/Image.html">Image</A> *image ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method RunlengthDecodeImage return True if the image is decoded. False is
returned if there is an error occurs.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

</DL></DL>
<P>
<HR>
<H2><A NAME="RunlengthEncodeImage">RunlengthEncodeImage</A></H2>
<P>
Method RunlengthEncodeImage packs the runlength-encoded pixel packets into
the minimum number of bytes.

<P>
The format of the RunlengthEncodeImage method is:

<blockquote>unsigned int RunlengthEncodeImage ( <A HREF="types/Image.html">Image</A> *image ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method RunlengthEncodeImage return the number of bytes the image consumes.
Zero is returned if an error occurs.

<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

</DL></DL>
<P>
<HR>
<H2><A NAME="SetRunlengthEncoder">SetRunlengthEncoder</A></H2>
<P>
Method SetRunlengthEncoder initializes the runlength encoder.

<P>
The format of the SetRunlengthEncoder function is:

<blockquote>SetRunlengthEncoder ( packet ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>packet:</STRONG><DD>
<P>
Specifies a RunlengthPacket type.

</DL></DL>
<P>
<HR>
<H2><A NAME="SetRunlengthPackets">SetRunlengthPackets</A></H2>
<P>
Method SetRunlengthPackets initializes the runlength encoder.

<P>
The format of the SetRunlengthPackets function is:

<blockquote>SetRunlengthPackets ( image, packets ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

<p><dt><STRONG>packets:</STRONG><DD>
<P>
The number of runlength packets.

</DL></DL>
<P>
<HR>
<H2><A NAME="ZLIBEncodeImage">ZLIBEncodeImage</A></H2>
<P>
Method ZLIBEncodeImage compresses an image via ZLIB-coding specific to Postscript Level 
<FONT SIZE=-1>II</FONT> or Portable Document Format. To ensure portability, the binary 
<FONT SIZE=-1>ZLIB</FONT> bytes are encoded as 
<FONT SIZE=-1>ASCII</FONT> base-85.


<P>
The format of the ZLIBEncodeImage method is:

<blockquote>unsigned int ZLIBEncodeImage ( <A HREF="types/Image.html">Image</A> *image, const unsigned long number_pixels, const unsigned int quality, unsigned char *pixels ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>status:</STRONG><DD>
<P>
Method ZLIBEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

<p><dt><STRONG>file:</STRONG><DD>
<P>
The address of a structure of type 
<FONT SIZE=-1>FILE.</FONT> 
<FONT SIZE=-1>ZLIB</FONT> encoded pixels are written to this file.


<p><dt><STRONG>number_pixels:</STRONG><DD>
<P>
An unsigned integer that specifies the number of pixels to compress.

<p><dt><STRONG>quality:</STRONG><DD>
<P>
the compression level (0-100).

<p><dt><STRONG>pixels:</STRONG><DD>
<P>
The address of an unsigned array of characters containing the pixels to
compress.

</DL></DL>
</BODY>

</HTML>
