File: compress.html

package info (click to toggle)
imagemagick 4.2.8-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 11,116 kB
  • ctags: 5,107
  • sloc: ansic: 98,927; sh: 11,151; cpp: 8,810; perl: 1,922; tcl: 458; makefile: 347
file content (419 lines) | stat: -rw-r--r-- 10,263 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<HTML>
<HEAD>
<TITLE>compress - Image Compression/Decompression Coders</TITLE>
<LINK REV="made" HREF="mailto:magick@wizards.dupont.com">
</HEAD>

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

<!-- 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*image)

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

<P>
unsigned int <STRONG>HuffmanEncodeImage</STRONG>(constImageInfo*image_info,Image*image)

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

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

<P>
<PRE> B&lt;SetRunlengthEncoder&gt;(packet)
</PRE>
<P>
<PRE> B&lt;SetRunlengthPackets&gt;(image,packets)
</PRE>
<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>
<DT><STRONG><A NAME="item_o">code:</A></STRONG><DD>
<P>
a binary unsigned char to encode to 
<FONT SIZE=-1>ASCII</FONT> 85.

<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>
<DT><STRONG>status:</STRONG><DD>
<P>
Method HuffmanDecodeImage returns True if all the pixels are compressed
without error, otherwise False.

<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>
<DT><STRONG>status:</STRONG><DD>
<P>
Method HuffmanEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

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

<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>
<DT><STRONG>status:</STRONG><DD>
<P>
Method Huffman2DEncodeImage returns True if all the pixels are compressed
without error, otherwise False.

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

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

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

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

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

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

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

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

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

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

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

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

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

<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>
<DT><STRONG>status:</STRONG><DD>
<P>
Method RunlengthDecodeImage return True if the image is decoded. False is
returned if there is an error occurs.

<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>
<DT><STRONG>status:</STRONG><DD>
<P>
Method RunlengthEncodeImage return the number of bytes the image consumes.
Zero is returned if an error occurs.

<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>
<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>
<DT><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

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

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

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

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

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


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

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

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

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

</HTML>