Debian Codegraph @

doc/png_optimization.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6 <meta name="Author" content="Cosmin Truţa">
7 <title>A guide to PNG optimization</title>
8 </head>
9 <body>
10
11 <h2>A guide to PNG optimization</h2>
12
13 <h3>1. Background</h3>
14
15 <h4>1.1 The PNG file format</h4>
16
17 <p>
18 The <a href="http://www.libpng.org/pub/png/">Portable Network Graphics</a>
19 (<b><i>PNG</i></b>) is a format for storing compressed raster graphics. The
20 compression engine is based on the <b><i>Deflate</i></b> method
21 [<a href="http://www.ietf.org/rfc/rfc1951">RFC1951</a>],
22 designed by
23 <a href="http://www.pkware.com/">PKWare</a>
24 and originally used in <b>PKZIP</b>.
25 </p>
26
27 <p>
28 The PNG format is defined by the
29 <a href="http://www.libpng.org/pub/png/spec/">PNG Specification</a>.
30 This specification was developed by an ad-hoc group named the
31 <a href="http://www.libpng.org/pub/png/">PNG Development Group</a>, and it is
32 both an International Standard (published under the formal name
33 ISO/IEC&nbsp;15948) and a W3C Recommendation.
34 </p>
35
36 <p>
37 PNG was initially intended as a superior, patent-free replacement of GIF. The
38 final outcome is a modern, extensible, reliable image format, capable to handle
39 an impressive number of image types (from 1-bit black-and-white images up to
40 48-bit RGB images with a full 16-bit alpha channel), and geared by a
41 significantly stronger lossless compression engine (typically 5-25% better than
42 GIF).
43 </p>
44
45 <p>
46 Unlike other lossless compression schemes, PNG compression does not depend
47 solely on the statistics of the input, but it may vary within wide limits,
48 depending on the compressor's implementation. A good PNG encoder must be
49 able to take informed decisions about the factors that affect the size of the
50 output. The purpose of this article is to provide information about these
51 factors, and to give advice on implementing efficient PNG encoders.
52 </p>
53
54
55 <h4>1.2 The PNG compression</h4>
56
57 <p>
58 The PNG compression works in a pipeline manner.
59 </p>
60
61 <p>
62 In the first stage, the image pixels are passed through a lossless arithmetic
63 transformation named <b><i>delta filtering</i></b>, or simply
64 <b><i>filtering</i></b>, and sent further as a (filtered) byte sequence.
65 Filtering does not compress or otherwise reduce the size of the data, but it
66 makes the data more compressible.
67 </p>
68
69 <p>
70 In the second stage, the filtered byte sequence is passed through the
71 Ziv-Lempel algorithm (LZ77), producing LZ77 codes that are further compressed
72 by the Huffman algorithm in the third and final stage. The combination of the
73 last two stages is referred to as the <b><i>Deflate compression</i></b>, a
74 widely-used, patent-free algorithm for universal, lossless data compression.
75 The maximum size of the LZ77 sliding window in Deflate is 32768 bytes, and the
76 LZ77 matches can be between 3 and 258 bytes long.
77 </p>
78
79 <p>
80 A complete description of the PNG compression is beyond the scope of this
81 guide. The PNG Specification describes the format completely, and provides
82 a complete list of references to the underlying technologies.
83 </p>
84
85
86 <h3>2. Factors that affect the PNG file size</h3>
87
88 <div>
89 Like any other compression scheme, PNG compression depends on the statistics
90 of the input data. In addition, it depends on the following PNG-specific
91 parameters:
92 </div>
93 <ol>
94 <li>
95 The PNG image type
96 </li>
97 <li>
98 The PNG delta filters
99 </li>
100 <li>
101 The strategy of searching LZ77 matches
102 </li>
103 <li>
104 The size of the Huffman buffers inside the Deflate encoder
105 </li>
106 </ol>
107
108 <p>
109 Depending on how these parameters are chosen by the implementation, PNG
110 compression may vary within wide limits. The process of selecting the best
111 configuration is computationally infeasible, but heuristics to select a
112 satisfactory configuration are available. The problem of improving these
113 heuristics constitutes an interesting subject for research.
114 </p>
115
116
117 <h4>2.1 The PNG image type</h4>
118
119 <p>
120 The type of a PNG image is defined in the <b><code>IHDR</code></b> image
121 header. The image has a certain bit depth, up to 16 bits per sample, and a
122 certain color type, from Grayscale to RGB+Alpha. If two PNG files of different
123 types represent exactly the same image, each file can be regarded as a lossless
124 transformation of the other. A lossless transformation can reduce the
125 <i>uncompressed</i> stream, and such a transformation is named <b><i>image
126 reduction</i></b>. In most cases, image reductions are capable of reducing the
127 <i>compressed</i> stream (which is, in fact, our interest), as an indirect
128 effect of reducing the size of the compressor's input.
129 </p>
130
131 <div>
132 The possible image reductions are:
133 </div>
134 <ul>
135 <li>
136 <i>Bit depth reduction</i>
137 <br>
138 The bit depth can be reduced to a minimum value that is acceptable for all
139 samples. For example, if all sample values in a 16-bit image have the form
140 (256+1)*<i>n</i>, (e.g. #0000, #2323, #FFFF), then the bit depth can be
141 reduced to 8, and the new sample values will become <i>n</i>, (e.g. #00, #23,
142 #FF).
143 </li>
144 <li>
145 <i>Color type reduction</i>
146 <br>
147 - If an RGB image has 256 distinct colors or less, it can be reencoded as a
148 Palette image.
149 <br>
150 - If an RGB or Palette image has only gray pixels, it can be reencoded as
151 Grayscale.
152 <br>
153 A color type reduction can also enable a bit depth reduction.
154 </li>
155 <li>
156 <i>Color palette reduction</i>
157 <br>
158 If the color palette contains redundant entries (i.e. duplicate entries that
159 indicate the same RGB value) or sterile entries (i.e. entries that do not
160 have a correspondent in the raw pixel data), these entries can be removed.
161 <br>
162 A color palette reduction can also enable a bit depth reduction.
163 </li>
164 <li>
165 <i>Alpha channel reduction</i>
166 <br>
167 If all pixels in a Grayscale+Alpha or an RGB+Alpha image are fully opaque
168 (i.e. all alpha components are equal to 2^<sup>bitdepth</sup>-1), or if the
169 transparency information can be stored entirely in a (much cheaper)
170 <b><code>tRNS</code></b> chunk, the alpha channel can be stripped.
171 </li>
172 </ul>
173
174 <p>
175 There are, however, a few cases when some image type reductions do not
176 necessarily lead to the reduction of the compressed stream. The
177 <a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a> site contains
178 experimental analyses of these possibilities; for example, see the article
179 <a href="8bpp.html">8 bits per pixel in paletted images</a>.
180 </p>
181
182 <p>
183 Interlacing, useful for a faster, progressive rendering, is another component
184 of the PNG image type that affects compression. In an interlaced stream, the
185 samples corresponding to neighboring pixels are stored far away, hence the data
186 in it is less correlated and less compressible. Unlike JPEG, where interlacing
187 may improve the compression slightly, the PNG interlacing degrades the
188 compression significantly.
189 </p>
190
191
192 <h4>2.2 The PNG delta filters</h4>
193
194 <p>
195 The role of filtering can be illustrated in the following example. Assume the
196 sequence 2, 3, 4, 5, 6, 7, 8, 9. Although it has much redundancy, the sequence
197 is not compressible by a Ziv-Lempel compressor, nor by a Huffman compressor.
198 However, if one makes a simple and reversible transformation, replacing each
199 value with the numerical difference between it and the value to its left, the
200 sequence becomes 2, 1, 1, 1, 1, 1, 1, 1, which is highly compressible.
201 </p>
202
203 <p>
204 The PNG format employs five types of filters: <b><i>None</i></b>,
205 <b><i>Left</i></b>, <b><i>Up</i></b>, <b><i>Average</i></b>, and
206 <b><i>Paeth</i></b>. The first filter leaves the original data intact, and the
207 other four are subtracting from each pixel a value that involves the
208 neighbor pixels from the left, up, and/or the upper left.
209 </p>
210
211 <p>
212 A certain filter is assigned to each row, and is applied to all pixels from
213 that row. Therefore, an image can be delta-filtered in a huge number of
214 possible configurations (5 ^ <sup><i>height</i></sup>), and each configuration
215 leads to a different compressed output. Two different filter configurations may
216 make a difference in the compressed file size by a couple of factors, so a
217 careful choice of filters is of paramount importance.
218 </p>
219
220 <p>
221 It is possible to apply a single filter to all rows, or to apply different
222 filters to different rows. In the former case, the filtering process is
223 <b><i>fixed</i></b>; in the latter, it is <b><i>adaptive</i></b>.
224 </p>
225
226 <div>
227 While an exhaustive search is unfeasible, the PNG Specification suggests a
228 heuristic filtering strategy:
229 </div>
230 <ul>
231 <li>
232 If the image type is Palette, or the bit depth is smaller than 8, then
233 do not filter the image (i.e. use fixed filtering, with the filter
234 <i>None</i>).
235 </li>
236 <li>
237 (The other case) If the image type is Grayscale or RGB (with or without
238 Alpha), and the bit depth is not smaller than 8, then use adaptive filtering
239 as follows: <i>independently for each row</i>, apply all five filters and
240 select the filter that produces the smallest sum of absolute values per row.
241 </li>
242 </ul>
243
244 <p>
245 Cases where the above heuristics are less than optimal are shown on the
246 <a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a>
247 site; for example, see
248 <a href="better-filtering.html">Brute-force vs. heuristic filtering</a>.
249 </p>
250
251
252 <h4>2.3 The strategy of searching LZ77 matches</h4>
253
254 <p>
255 The Ziv-Lempel algorithm works under the assumption that contiguous sequences
256 appear repeatedly in the input stream. If the sequence to be encoded matches
257 one or more sequences already present in the sliding history window, the
258 encoder sends a LZ77 pair (<i>distance</i>, <i>length</i>) that points to the
259 <i>closest</i> match. In most LZ77 incarnations, including Deflate, smaller
260 distance codes are encoded more concisely.
261 </p>
262
263 <p>
264 In Deflate, in particular, the regular (non-matched) symbols, and the match
265 lengths, are sent to the same Huffman coder, while the match distances are sent
266 to a separate Huffman coder. If the LZ77 matches fall between the accepted
267 boundaries (i.e. they are not shorter than 3 and not longer than 258), a greedy
268 strategy will accept them as a replacement for the symbols to which they
269 correspond.
270 </p>
271
272 <p>
273 The greedy strategy is preferable when compressing text files, or many types of
274 binary files, but it may be suboptimal when compressing filtered data, such as
275 the byte strings that come from a PNG filter. Filtered data consist mostly of
276 small values with a pseudo-random distribution. Therefore, in certain
277 situations, it may be desirable to favor the encoding of individual symbols,
278 even if matches that may replace these symbols exist.
279 </p>
280
281 <p>
282 The
283 <a href="http://www.zlib.org/">zlib Reference Library</a>
284 is a reference implementation of Deflate, which is further used by the
285 <a href="http://www.libpng.org/pub/png/libpng.html">PNG Reference Library</a>.
286 By default, <b>zlib</b> selects the greedy strategy, but the user is able to
287 specify his or her custom preference via the <code>strategy</code> parameter.
288 This parameter can take one of the following values:
289 <br>
290 - <code>Z_DEFAULT_STRATEGY = 0</code>, the default greedy search strategy.
291 <br>
292 - <code>Z_FILTERED = 1</code>, a strategy in which the matches are accepted
293 only if their length is 6 or bigger.
294 <br>
295 - <code>Z_HUFFMAN_ONLY = 2</code>, a fast strategy in which the Ziv-Lempel
296 algorithm is entirely bypassed, and all the symbols from the input are encoded
297 directly by the Huffman coder.
298 <br>
299 - <code>Z_RLE = 3</code> (appeared in the <b>zlib-1.2.x</b> series), a fast
300 strategy in which the LZ77 algorithm is essentially reduced to the Run-Length
301 Encoding algorithm. In other words, the matches are accepted only if their
302 distance is 1. For example, the 10-symbol sequence "<code>aaaaaaaaaa</code>"
303 can be LZ77-encoded as
304 ['<code>a</code>', (<i>distance</i>=1, <i>length</i>=9)];
305 by removing <i>distance</i>=1 from the picture, this encoding can be regarded
306 as a peculiar run-length encoding (which differs from the classic RLE by using
307 <i>length</i>=9 instead of <i>count</i>=10).
308 <br>
309 The <code>strategy</code> parameter affects only the compression ratio. It does
310 not affect the correctness of the compressed output, even if it is set to an
311 inappropriate value.
312 </p>
313
314 <p>
315 It was experimentally observed that the LZ77 search is occasionally capable of
316 producing smaller PNGs if it is less exhaustive. The reason behind this act
317 resides in the same category of "strategic searches" discussed here.
318 Unfortunately, there is no known method of anticipating which search level
319 (from the fastest and the least exhaustive, to the slowest and the most
320 exhaustive) is better, other than assuming "the most exhaustive is better in
321 most cases".
322 </p>
323
324 <p>
325 Unfortunately, even a "filtered" strategy does not always produce better
326 results than a "greedy" strategy on filtered input, and the only known method
327 to obtain the best combination is by multiple trials. Experiments and
328 measurements can, again, be found on the
329 <a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a>
330 site; for example, see the original
331 <a href="z_rle.html">Z_RLE strategy proposal</a>.
332 </p>
333
334
335 <h4>2.4 The size of Huffman buffers</h4>
336
337 <p>
338 As mentioned earlier, the entropy encoder inside the Deflate method is the
339 static Huffman algorithm. The output of LZ77 is fed into a buffer which is
340 occasionally flushed by sending a static Huffman tree followed by all the
341 Huffman codes, to the output of Deflate. After this, both the buffer and the
342 Huffman tree are reset, waiting for the subsequent LZ77 codes to come and
343 refill the buffer.
344 </p>
345
346 <blockquote>
347 The Deflate specification refers to <i>dynamic Huffman codes</i>. However, this
348 is a misnomer, in which the term <i>dynamic</i> is used in contrast to the
349 <i>fixed</i> Huffman codes. The fixed Huffman codes are simply built according
350 to a predefined Huffman tree, without regard to the actual symbol frequencies.
351 The dynamic Huffman codes referred to by the Deflate specification are NOT
352 built by the dynamic Huffman algorithm, as defined, for example, by Faller,
353 Gallager and Knuth (the FGK algorithm), or by Vitter (the V algorithm).
354 The predefined Huffman tree was introduced in <b>PKZIP</b> as a fast
355 compression alternative, but it produces poor results even on text, and it is
356 almost useless in PNG compression. Still, a PNG stream that contains codes
357 built by the fixed (predefined) Huffman tree, is a valid stream, and a
358 compliant PNG reader must decode this stream correctly.
359 </blockquote>
360
361 <p>
362 It is desirable to establish the buffer boundaries so that sequences conforming
363 to the same probability model are fit in the same Huffman buffer. Methods for
364 approaching these boundaries exist, but they are not used in the mainstream
365 Deflate implementation(s). Instead, the buffers are flushed when a limit
366 (typically, 16k LZ77 codes) is reached. This is, however, a fast approach, and
367 the results are satisfactory.
368 </p>
369
370 <p>
371 The size of Huffman buffers is indirectly determined by the encoder's memory
372 (usage) level. For this reason, certain memory levels might be good for certain
373 types of images.
374 </p>
375
376
377 <h3>3. PNG (lossless) optimization programs</h3>
378
379 <p>
380 The multitude of PNG encoding programs is listed at
381 <a href="http://www.libpng.org/pub/png/pngapps.html">http://www.libpng.org/pub/png/pngapps.html</a>.
382 Their performance varies as much as the range of possible compression ratios;
383 the good encoders are at least applying the filtering heuristics, described
384 briefly in the PNG Specification, and illustrated above.
385 <br>
386 Some programs gain extra compression by discarding some of the data in the
387 input images (so these programs are <i>lossy</i>!)
388 </p>
389
390 <p>
391 This section contains the small list of <b><i>PNG optimization programs</i></b>
392 that show a particular concern towards obtaining a file size as small as
393 possible. They work by performing repeated compression trials, applying various
394 parameter sets, and selecting the parameter set that yields the smallest
395 compressed output.
396 </p>
397
398 <ul>
399 <li>
400 <p>
401 <b>pngrewrite</b> by Jason Summers, available at
402 <a href="http://www.pobox.com/~jason1/pngrewrite/">http://www.pobox.com/~jason1/pngrewrite</a>,
403 is an open-source program that performs lossless image reductions.
404 It works best in conjunction with <b>pngcrush</b> (see below); the user
405 should run <b>pngcrush</b> <i>after</i> <b>pngrewrite</b>.
406 </p>
407 </li>
408 <li>
409 <p>
410 <b>pngcrush</b> by Glenn Randers-Pehrson, available at
411 <a href="http://pmt.sourceforge.net/pngcrush/">http://pmt.sourceforge.net/pngcrush</a>,
412 is an open-source program that iterates over PNG filters and zlib (Deflate)
413 parameters, compresses the image repeatedly using each parameter
414 configuration, and chooses the configuration that yields the smallest
415 compressed (IDAT) output.
416 At the user's option, the program can explore few (below 10) or many (a
417 brute-force traversal over more than 100) configurations. The method of
418 selecting the parameters for "few" trials is particularly effective, and the
419 use of a brute-force traversal is generally not recommended.
420 </p>
421 <p>
422 In addition, <b>pngcrush</b> offers a multitude of extra features, such as
423 recovery of erroneous PNG files (e.g. files containing bad CRCs), and
424 chunk-level editing of PNG meta-data.
425 </p>
426 </li>
427 <li>
428 <p>
429 <b>OptiPNG</b> by Cosmin Truţa, available at
430 <a href="http://www.cs.toronto.edu/~cosmin/pngtech/optipng/">http://www.cs.toronto.edu/pngtech/optipng</a>,
431 is a newer open-source program, inspired from <b>pngcrush</b>, but designed
432 to be more flexible and to run faster.
433 Unlike <b>pngcrush</b>, <b>OptiPNG</b> performs the trials entirely in
434 memory, and writes only the final output file on the disk. Moreover, it
435 offers multiple optimization presets to the user, who can choose among a
436 range of options from "very few trials" to "very many trials" (in contrast to
437 the coarser "smart vs. brute" option offered by <b>pngcrush</b>).
438 </p>
439 <p>
440 It is important to mention that the achieved compression ratio is less and
441 less likely to improve when higher-level presets (trigerring more trials)
442 are being used. Even if the program is capable of searching automatically
443 over more than 200 configurations (and the advanced users have access to more
444 than 1000 configurations!), a preset that selects around 10 trials should be
445 satisfactory for most users. Furthermore, a preset that selects between
446 30-40 trials <i>should</i> be satisfactory for all users, for it is very,
447 very unlikely to be beaten significantly by any wider search. The rest of the
448 trial configurations are offered rather as a curiosity (but they were used in
449 the experimentation from which we concluded they are indeed useless!)
450 </p>
451 </li>
452 <li>
453 <p>
454 <b>AdvanceCOMP</b> by Andrea Mazzoleni is a set of tools for optimizing
455 ZIP/GZIP, PNG and MNG files, based on the powerful <b>7-Zip</b> deflation
456 engine. The name of the PNG optimization tool is <b>AdvPNG</b>. At the time
457 of this writing, <b>AdvPNG</b> does not perform image reductions, so the use
458 of <b>pngrewrite</b> or <b>OptiPNG</b> prior to optimiziation may be
459 necessary. However, given the effectivenes of <b>7-Zip</b> deflation,
460 <b>AdvanceCOMP</b> is a powerful contender.
461 </p>
462 <p>
463 The <b>AdvanceCOMP</b> tool set is a part of the <b>AdvanceMAME</b> project,
464 available at
465 <a href="http://advancemame.sourceforge.net/">http://advancemame.sourceforge.net</a>.
466 </p>
467 </li>
468 <li>
469 <p>
470 <b>PNGOut</b> by Ken Silverman, available at
471 <a href="http://advsys.net/ken/utils.htm">http://advsys.net/ken/utils.htm</a>,
472 is a freely-available compiled program (no source code), running on
473 Windows and Linux. According to our tests, the compression ratio achieved by
474 <b>PNGOut</b> is comparable to that of <b>AdvPNG</b>.
475 Unfortunately, due to the lack of information, we cannot say much about this
476 tool.
477 </p>
478 <p>
479 A nice GUI frontend for <b>PNGOut</b>, named <b>PNGGauntlet</b>, is
480 available at
481 <a href="http://www.numbera.com/software/pnggauntlet.aspx">http://www.numbera.com/software/pnggauntlet.aspx</a>.
482 </p>
483 </li>
484 </ul>
485
486
487 <h3>4. An extra note on losslessness</h3>
488
489 <p>
490 What is lossless PNG optimization, after all? This is a straightforward
491 question, whose answer is intuitive, yet not so straightforward.
492 </p>
493
494 <p>
495 Losslessness in the strictest sense, where no information whatsoever is lost,
496 can only be achieved by leaving the original file (<i>any</i> file) intact, or
497 by transforming it (e.g. compressing it, encrypting it) in such a way that
498 there is an inverse transformation which recovers it completely, bit by bit.
499 </p>
500
501 <p>
502 In the case of PNG images, this condition of strict losslessness has little
503 relevance to the casual graphics user, and is, therefore, too strong.
504 There are instances where strict losslessness is required; for example, when
505 handling certified PNG files whose integrity is guaranteed by an external
506 checksum like <b>MD5</b> or <b>SHA</b>, or by a digital signature such as
507 <b><code>dSIG</code></b>. Most of the time, however, it is desirable to relax
508 the notion of PNG losslessness, to the extent of not losing any information
509 that pertains to the <i>rendered image</i> and to the
510 <i>semantic value of the metadata</i> that accompanies the image. This allows
511 the user to concentrate on what is really important when it comes to preserving
512 the contents of a PNG image, and enables the concept of PNG optimization tools.
513 </p>
514
515 <blockquote>
516 A <b><i>lossless transform</i></b> of a PNG image file is a transform which
517 fully preserves the <i>rendered</i> RGB triples (the RGB triples that come
518 either directly, or from a palette index, or from a gray->RGB expansion), the
519 <i>rendered</i> transparency (the alpha samples that come either directly, or
520 from a <b><code>tRNS</code></b> chunk, or the implicit 100% opacity assumed due
521 to the lack of any explicit transparency information), the <i>order of
522 rendering</i> (sequential or interlaced), and the semantics contained by the
523 ancillary chunks.
524 </blockquote>
525
526 <div>
527 This definition allows the execution of the above-mentioned image reduction
528 operations, and the recompression of <b><code>IDAT</code></b>. It also allows
529 the alteration or the elimination of other pieces of information that are
530 technically valid, but have no influence on any presentation of the image
531 pixels:
532 </div>
533 <ul>
534 <li>
535 The information that pertains to <b><i>Deflate</i></b> streams, either inside
536 <b><code>IDAT</code></b>, or in other compressed chunks like
537 <b><code>zTXt</code></b>, <b><code>iTXt</code></b> or
538 <b><code>iCCP</code></b>; e.g. the LZ77 window size, the type and size of
539 <b><i>Deflate</i></b> blocks, etc. (The only thing that matters is that the
540 decompressed byte sequence must remain the same.)
541 </li>
542 <li>
543 The order of palette entries inside a <b><code>PLTE</code></b> chunk. (When
544 changing this order, the information that depends on it, such as the
545 palette-encoded pixels or the <b><code>tRNS</code></b> information, must be
546 updated accordingly.)
547 </li>
548 <li>
549 RGB triples that do not correspond to any pixel in the actual image, but are
550 stored in a <b><code>tRNS</code></b> chunk.
551 </li>
552 <li>
553 Fully opaque <b><code>tRNS</code></b> entries in a palette image.
554 </li>
555 <li>
556 Gamma correction (<b><code>gAMA</code></b>) or significant bit
557 (<b><code>sBIT</code></b>) information inside an image that consists
558 exclusively of samples whose intensity is either minimum (0) or maximum
559 (2^<sup>bitdepth</sup>-1).
560 </li>
561 <li>
562 The fact that a textual comment is stored uncompressed in a
563 <b><code>tEXt</code></b> chunk, or compressed in a <b><code>zTXt</code></b>
564 chunk, or with no translation in an <b><code>iTXt</code></b> chunk.
565 </li>
566 <li>
567 Etcetera.
568 </li>
569 </ul>
570
571 <p>
572 If any of the discardable information is important in a particular application,
573 and lossless PNG optimization is still desirable, it is recommended to store
574 this information in ancillary chunks, rather than hack it inside critical
575 chunks. For example, if sterile palette entries are necessary (e.g. for later
576 editing stages), it is recommended to store them inside a suggested palette
577 (<b><code>sPLT</code></b>) chunk, rather than keeping them inside
578 <b><code>PLTE</code></b>.
579 </p>
580
581
582 <h3>5. Selective bibliography</h3>
583
584 <p>
585 Besides the discussed specifications, the references below provide essential
586 information necessary to comprehend the contents of this article.
587 </p>
588
589 <ul>
590 <li>
591 Thomas Boutell, Glenn Randers-Pehrson et al.
592 <i>Portable Network Graphics (PNG) Specification, Second Edition</i>.
593 ISO/IEC 15948:2003(E); W3C Recommendation 10 November 2003.
594 </li>
595 <li>
596 David A. Huffman.
597 A method for the construction of minimum redundancy codes.
598 In <i>Proceedings of the Institute of Radio Engineers</i>,
599 vol. 40, no. 9, pp. 1098-1101, September 1952.
600 </li>
601 <li>
602 Jacob Ziv and Abraham Lempel.
603 A universal algorithm for data compression.
604 <i>IEEE Transactions on Information Theory</i>,
605 vol. IT-23, no. 3, pp. 337-343, May 1977.
606 <br>
607 <font size="-1">
608 Due to a historical accident, the famous algorithm is better-known as the
609 "Lempel-Ziv (LZ) algorithm", even though the "Ziv-Lempel algorithm" is a
610 more legitimate name.
611 </font>
612 </li>
613 <li>
614 Greg Roelofs.
615 <i>PNG: The definitive guide</i>.
616 O'Reilly and Associates, 1999.
617 </li>
618 </ul>
619
620
621 <hr>
622
623 <address>
624 <font size="-1">
625 Copyright &copy; 2003-2008 Cosmin Truţa. Permission to distribute freely.
626 <br>
627 Appeared: 7&nbsp;Apr&nbsp;2003.
628 <br>
629 Last updated: 10&nbsp;May&nbsp;2008.
630 </font>
631 </address>
632
633 </body>
634 </html>