Debian Codegraph @

doc/optipng.man1.html

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.1" />
8 <title>OPTIPNG(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
15 }
16
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
25 }
26
27 body {
28 margin: 1em 5% 1em 5%;
29 }
30
31 a {
32 color: blue;
33 text-decoration: underline;
34 }
35 a:visited {
36 color: fuchsia;
37 }
38
39 em {
40 font-style: italic;
41 color: navy;
42 }
43
44 strong {
45 font-weight: bold;
46 color: #083194;
47 }
48
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54 }
55
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
58 }
59 h2 {
60 padding-top: 0.5em;
61 }
62 h3 {
63 float: left;
64 }
65 h3 + * {
66 clear: left;
67 }
68 h5 {
69 font-size: 1.0em;
70 }
71
72 div.sectionbody {
73 margin-left: 0;
74 }
75
76 hr {
77 border: 1px solid silver;
78 }
79
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83 }
84
85 ul, ol, li > p {
86 margin-top: 0;
87 }
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
90
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
97 }
98 pre {
99 white-space: pre-wrap;
100 }
101
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
106 }
107 #email {
108 }
109 #revnumber, #revdate, #revremark {
110 }
111
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117 }
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
121 }
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
125 }
126
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130 }
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
136 }
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
142 }
143
144 div.content { /* Block element content. */
145 padding: 0;
146 }
147
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155 }
156 div.title + * {
157 margin-top: 0;
158 }
159
160 td div.title:first-child {
161 margin-top: 0.0em;
162 }
163 div.content div.title:first-child {
164 margin-top: 0.0em;
165 }
166 div.content + div.title {
167 margin-top: 0.0em;
168 }
169
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
175 }
176
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
182 }
183
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
190 }
191
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
195 }
196
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
200 }
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204 }
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
208 }
209
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
217 }
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
221 }
222
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
226 }
227
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
231
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235 }
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
241 }
242 dd > *:first-child {
243 margin-top: 0.1em;
244 }
245
246 ul, ol {
247 list-style-position: outside;
248 }
249 ol.arabic {
250 list-style-type: decimal;
251 }
252 ol.loweralpha {
253 list-style-type: lower-alpha;
254 }
255 ol.upperalpha {
256 list-style-type: upper-alpha;
257 }
258 ol.lowerroman {
259 list-style-type: lower-roman;
260 }
261 ol.upperroman {
262 list-style-type: upper-roman;
263 }
264
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270 }
271
272 tfoot {
273 font-weight: bold;
274 }
275 td > div.verse {
276 white-space: pre;
277 }
278
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282 }
283 div.hdlist tr {
284 padding-bottom: 15px;
285 }
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288 }
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
294 }
295 td.hdlist2 {
296 vertical-align: top;
297 }
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301 }
302
303 .comment {
304 background: yellow;
305 }
306
307 .footnote, .footnoteref {
308 font-size: 0.8em;
309 }
310
311 span.footnote, span.footnoteref {
312 vertical-align: super;
313 }
314
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318 }
319
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
322 }
323
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
332 }
333
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338 }
339 div.colist td img {
340 margin-top: 0.3em;
341 }
342
343 @media print {
344 #footer-badges { display: none; }
345 }
346
347 #toc {
348 margin-bottom: 2.5em;
349 }
350
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357 }
358
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
362 }
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366 }
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370 }
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374 }
375
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
392
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
409
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
412
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
416
417 div.unbreakable { page-break-inside: avoid; }
418
419
420 /*
421 * xhtml11 specific
422 *
423 * */
424
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428 }
429 div.tableblock > table {
430 border: 3px solid #527bbd;
431 }
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435 }
436 p.table {
437 margin-top: 0;
438 }
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
442 }
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446 }
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450 }
451
452
453 /*
454 * html5 specific
455 *
456 * */
457
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461 }
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465 }
466 p.tableblock {
467 margin-top: 0;
468 }
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475 }
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481 }
482
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486 }
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490 }
491 table.tableblock.frame-none {
492 border-style: hidden;
493 }
494
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497 }
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500 }
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503 }
504
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507 }
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510 }
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513 }
514
515
516 /*
517 * manpage specific
518 *
519 * */
520
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526 }
527 body.manpage h2 {
528 border-style: none;
529 }
530 body.manpage div.sectionbody {
531 margin-left: 3em;
532 }
533
534 @media print {
535 body.manpage div#toc { display: none; }
536 }
537
538
539 </style>
540 </head>
541 <body class="manpage">
542 <div id="header">
543 <h1>
544 OPTIPNG(1) Manual Page
545 </h1>
546 <h2>NAME</h2>
547 <div class="sectionbody">
548 <p>optipng -
549 optimize Portable Network Graphics (PNG) files
550 </p>
551 </div>
552 </div>
553 <div id="content">
554 <div class="sect1">
555 <h2 id="_synopsis">SYNOPSIS</h2>
556 <div class="sectionbody">
557 <div class="paragraph"><p><strong>optipng</strong> [&lt;<em>options&#8230;</em>&gt;] [--] &lt;<em>files&#8230;</em>&gt;</p></div>
558 </div>
559 </div>
560 <div class="sect1">
561 <h2 id="_description">DESCRIPTION</h2>
562 <div class="sectionbody">
563 <div class="paragraph"><p>The OptiPNG program shall attempt to <em>optimize</em> PNG files, i.e. to
564 reduce their size to a minimum, without losing semantic information.
565 In addition, this program shall perform a suite of auxiliary functions
566 like integrity checks, metadata recovery and pixmap-to-PNG conversion.</p></div>
567 <div class="paragraph"><p>The optimization attempts are not guaranteed to succeed.
568 Valid PNG files that cannot be optimized by this program are normally
569 left intact; their size will not grow.
570 The user may request to override this default behavior.</p></div>
571 </div>
572 </div>
573 <div class="sect1">
574 <h2 id="_files">FILES</h2>
575 <div class="sectionbody">
576 <div class="paragraph"><p>The input files are raster image files encoded either in PNG format
577 (the native format), or in an external format.
578 The currently supported external formats are GIF, BMP, PNM and TIFF.</p></div>
579 <div class="paragraph"><p>OptiPNG processes each image file given in the command line as
580 follows:</p></div>
581 <div class="ulist"><ul>
582 <li>
583 <p>
584 If the image is in PNG format:
585 </p>
586 <div class="paragraph"><p>It attempts to optimize the given file in-place.
587 If optimization is successful, or if the option <strong>-force</strong> is enabled,
588 the original file will be replaced by its optimized version.
589 In any case, the original file will be backed up if the option <strong>-keep</strong>
590 is enabled.</p></div>
591 </li>
592 <li>
593 <p>
594 If the image is in an external format:
595 </p>
596 <div class="paragraph"><p>It creates an optimized PNG version of the given file.
597 The output file name will be constructed using the original file name
598 and the <code>.png</code> extension.</p></div>
599 </li>
600 </ul></div>
601 <div class="paragraph"><p>Aside from the rules stated above, any existing file is <em>not</em>
602 overwritten, unless the option <strong>-clobber</strong> is enabled.</p></div>
603 </div>
604 </div>
605 <div class="sect1">
606 <h2 id="_options">OPTIONS</h2>
607 <div class="sectionbody">
608 <div class="sect2">
609 <h3 id="_general_options">General options</h3>
610 <div class="dlist"><dl>
611 <dt class="hdlist1">
612 <strong>-?</strong>, <strong>-h</strong>, <strong>-help</strong>
613 </dt>
614 <dd>
615 <p>
616 Show a complete summary of options.
617 </p>
618 </dd>
619 <dt class="hdlist1">
620 <strong>-backup</strong>, <strong>-keep</strong>
621 </dt>
622 <dd>
623 <p>
624 Keep a backup of the modified files.
625 </p>
626 </dd>
627 <dt class="hdlist1">
628 <strong>-clobber</strong>
629 </dt>
630 <dd>
631 <p>
632 Overwrite the existing output and backup files.
633 </p>
634 <div class="paragraph"><p>Under this option, if the option <strong>-backup</strong> is not enabled, the old
635 backups of the overwritten files will be deleted.</p></div>
636 </dd>
637 <dt class="hdlist1">
638 <strong>-dir</strong> <em>directory</em>
639 </dt>
640 <dd>
641 <p>
642 Write the output files to <em>directory</em>.
643 </p>
644 </dd>
645 <dt class="hdlist1">
646 <strong>-fix</strong>
647 </dt>
648 <dd>
649 <p>
650 Enable error recovery. This option has no effect on valid input
651 files.
652 </p>
653 <div class="paragraph"><p>The program will spend a reasonable amount of effort to recover as
654 much data as possible, without increasing the output file size, but
655 the success cannot be generally guaranteed.
656 The program may even increase the file size, e.g., by reconstructing
657 missing critical data.
658 Under this option, integrity shall take precedence over file size.</p></div>
659 <div class="paragraph"><p>When this option is not used, the invalid input files are left
660 unprocessed.</p></div>
661 </dd>
662 <dt class="hdlist1">
663 <strong>-force</strong>
664 </dt>
665 <dd>
666 <p>
667 Enforce writing of a new output file.
668 </p>
669 <div class="paragraph"><p>This option overrides the program&#8217;s decision not to write such file,
670 e.g. when the PNG input is digitally signed (using dSIG), or when the
671 PNG output becomes larger than the PNG input.</p></div>
672 </dd>
673 <dt class="hdlist1">
674 <strong>-out</strong> <em>file</em>
675 </dt>
676 <dd>
677 <p>
678 Write output file to <em>file</em>.
679 </p>
680 <div class="paragraph"><p>The command line must contain exactly one input file.</p></div>
681 </dd>
682 <dt class="hdlist1">
683 <strong>-preserve</strong>
684 </dt>
685 <dd>
686 <p>
687 Preserve file attributes (time stamps, file access rights, etc.)
688 where applicable.
689 </p>
690 </dd>
691 <dt class="hdlist1">
692 <strong>-quiet</strong>, <strong>-silent</strong>
693 </dt>
694 <dd>
695 <p>
696 Run in quiet mode.
697 </p>
698 </dd>
699 <dt class="hdlist1">
700 <strong>-simulate</strong>
701 </dt>
702 <dd>
703 <p>
704 Run in simulation mode: perform the trials, but do not create
705 output files.
706 </p>
707 </dd>
708 <dt class="hdlist1">
709 <strong>-v</strong>
710 </dt>
711 <dd>
712 <p>
713 Enable the options <strong>-verbose</strong> and <strong>-version</strong>.
714 </p>
715 </dd>
716 <dt class="hdlist1">
717 <strong>-verbose</strong>
718 </dt>
719 <dd>
720 <p>
721 Run in verbose mode.
722 </p>
723 </dd>
724 <dt class="hdlist1">
725 <strong>-version</strong>
726 </dt>
727 <dd>
728 <p>
729 Show the copyright, version and build info.
730 </p>
731 </dd>
732 <dt class="hdlist1">
733 <strong>--</strong>
734 </dt>
735 <dd>
736 <p>
737 Stop option switch parsing.
738 </p>
739 </dd>
740 </dl></div>
741 </div>
742 <div class="sect2">
743 <h3 id="_png_encoding_and_optimization_options">PNG encoding and optimization options</h3>
744 <div class="dlist"><dl>
745 <dt class="hdlist1">
746 <strong>-o</strong> <em>level</em>
747 </dt>
748 <dd>
749 <p>
750 Select the optimization level.
751 </p>
752 <div class="paragraph"><p>The optimization level 0 enables a set of optimization operations
753 that require minimal effort.
754 There will be no changes to image attributes like bit depth or color
755 type, and no recompression of existing IDAT datastreams.</p></div>
756 <div class="paragraph"><p>The optimization level 1 enables a single IDAT compression trial.
757 The trial chosen is what OptiPNG <em>thinks</em> it might be the most
758 effective.</p></div>
759 <div class="paragraph"><p>The optimization levels 2 and higher enable multiple IDAT compression
760 trials; the higher the level, the more trials.</p></div>
761 <div class="paragraph"><p>The behavior and the default value of this option may change across
762 different program versions.
763 Use the option <strong>-h</strong> to see the details pertaining to your specific
764 version.</p></div>
765 </dd>
766 <dt class="hdlist1">
767 <strong>-f</strong> <em>filters</em>
768 </dt>
769 <dd>
770 <p>
771 Select the PNG delta filters.
772 </p>
773 <div class="paragraph"><p>The <em>filters</em> argument is specified as a rangeset (e.g. <strong>-f0-5</strong>), and
774 the default <em>filters</em> value depends on the optimization level set by
775 the option <strong>-o</strong>.</p></div>
776 <div class="paragraph"><p>The filter values 0, 1, 2, 3 and 4 indicate static filtering, and
777 correspond to the standard PNG filter codes
778 (<em>None</em>, <em>Left</em>, <em>Up</em>, <em>Average</em> and <em>Paeth</em>, respectively).
779 The filter value 5 indicates adaptive filtering, whose effect is
780 defined by the <strong>libpng</strong>(3) library used by OptiPNG.</p></div>
781 </dd>
782 <dt class="hdlist1">
783 <strong>-full</strong>
784 </dt>
785 <dd>
786 <p>
787 Produce a full report on IDAT.
788 This option might slow down the trials.
789 </p>
790 </dd>
791 <dt class="hdlist1">
792 <strong>-i</strong> <em>type</em>
793 </dt>
794 <dd>
795 <p>
796 Select the interlace type (0-1).
797 </p>
798 <div class="paragraph"><p>If the interlace type 0 is selected, the output image shall be
799 non-interlaced (i.e. progressive-scanned).
800 If the interlace type 1 is selected, the output image shall be
801 interlaced using the <em>Adam7</em> method.</p></div>
802 <div class="paragraph"><p>By default, the output shall have the same interlace type as the
803 input.</p></div>
804 </dd>
805 <dt class="hdlist1">
806 <strong>-nb</strong>
807 </dt>
808 <dd>
809 <p>
810 Do not apply bit depth reduction.
811 </p>
812 </dd>
813 <dt class="hdlist1">
814 <strong>-nc</strong>
815 </dt>
816 <dd>
817 <p>
818 Do not apply color type reduction.
819 </p>
820 </dd>
821 <dt class="hdlist1">
822 <strong>-np</strong>
823 </dt>
824 <dd>
825 <p>
826 Do not apply palette reduction.
827 </p>
828 </dd>
829 <dt class="hdlist1">
830 <strong>-nx</strong>
831 </dt>
832 <dd>
833 <p>
834 Do not apply any lossless image reduction:
835 enable the options <strong>-nb</strong>, <strong>-nc</strong> and <strong>-np</strong>.
836 </p>
837 </dd>
838 <dt class="hdlist1">
839 <strong>-nz</strong>
840 </dt>
841 <dd>
842 <p>
843 Do not recode IDAT datastreams.
844 </p>
845 <div class="paragraph"><p>The IDAT optimization operations that do not require recoding
846 (e.g. IDAT chunk concatenation) are still performed.</p></div>
847 <div class="paragraph"><p>This option has effect on PNG input files only.</p></div>
848 </dd>
849 <dt class="hdlist1">
850 <strong>-zc</strong> <em>levels</em>
851 </dt>
852 <dd>
853 <p>
854 Select the zlib compression levels used in IDAT compression.
855 </p>
856 <div class="paragraph"><p>The <em>levels</em> argument is specified as a rangeset (e.g. <strong>-zc6-9</strong>),
857 and the default <em>levels</em> value depends on the optimization level set
858 by the option <strong>-o</strong>.</p></div>
859 <div class="paragraph"><p>The effect of this option is defined by the <strong>zlib</strong>(3) library used by
860 OptiPNG.</p></div>
861 </dd>
862 <dt class="hdlist1">
863 <strong>-zm</strong> <em>levels</em>
864 </dt>
865 <dd>
866 <p>
867 Select the zlib memory levels used in IDAT compression.
868 </p>
869 <div class="paragraph"><p>The <em>levels</em> argument is specified as a rangeset (e.g. <strong>-zm8-9</strong>), and
870 the default <em>levels</em> value depends on the optimization level set by
871 the option <strong>-o</strong>.</p></div>
872 <div class="paragraph"><p>The effect of this option is defined by the <strong>zlib</strong>(3) library used by
873 OptiPNG.</p></div>
874 </dd>
875 <dt class="hdlist1">
876 <strong>-zs</strong> <em>strategies</em>
877 </dt>
878 <dd>
879 <p>
880 Select the zlib compression strategies used in IDAT compression.
881 </p>
882 <div class="paragraph"><p>The <em>strategies</em> argument is specified as a rangeset (e.g. <strong>-zs0-3</strong>),
883 and the default <em>strategies</em> value depends on the optimization level
884 set by the option <strong>-o</strong>.</p></div>
885 <div class="paragraph"><p>The effect of this option is defined by the <strong>zlib</strong>(3) library used by
886 OptiPNG.</p></div>
887 </dd>
888 <dt class="hdlist1">
889 <strong>-zw</strong> <em>size</em>
890 </dt>
891 <dd>
892 <p>
893 Select the zlib window size (32k,16k,8k,4k,2k,1k,512,256) used in
894 IDAT compression.
895 </p>
896 <div class="paragraph"><p>The <em>size</em> argument can be specified either in bytes (e.g. 16384) or
897 kilobytes (e.g. 16k). The default <em>size</em> value is set to the lowest
898 window size that yields an IDAT output as big as if yielded by the
899 value 32768.</p></div>
900 <div class="paragraph"><p>The effect of this option is defined by the <strong>zlib</strong>(3) library used by
901 OptiPNG.</p></div>
902 </dd>
903 </dl></div>
904 </div>
905 <div class="sect2">
906 <h3 id="_editing_options">Editing options</h3>
907 <div class="dlist"><dl>
908 <dt class="hdlist1">
909 <strong>-snip</strong>
910 </dt>
911 <dd>
912 <p>
913 Cut one image out of multi-image, animation or video files.
914 </p>
915 <div class="paragraph"><p>Depending on the input format, this may be either the first or the
916 most relevant (e.g. the largest) image.</p></div>
917 </dd>
918 <dt class="hdlist1">
919 <strong>-strip</strong> <em>objects</em>
920 </dt>
921 <dd>
922 <p>
923 Strip metadata objects from a PNG file.
924 </p>
925 <div class="paragraph"><p>PNG metadata is the information stored in any ancillary chunk except
926 tRNS.
927 (tRNS represents the alpha channel, which, even if ignored in
928 rendering, is still a proper image channel in the RGBA color space.)</p></div>
929 <div class="paragraph"><p>The only option currently supported is <strong>-strip all</strong>.</p></div>
930 </dd>
931 </dl></div>
932 </div>
933 <div class="sect2">
934 <h3 id="_notes">Notes</h3>
935 <div class="paragraph"><p>Options may come in any order (except for <strong>--</strong>), before, after, or
936 alternating with file names.
937 Option names are case-insensitive and may be abbreviated to their
938 shortest unique prefix.</p></div>
939 <div class="paragraph"><p>Some options may have arguments that follow the option name,
940 separated by whitespace or the equal sign (<em><strong>=</strong></em>).
941 If the option argument is a number or a rangeset, the separator may
942 be omitted.
943 For example:</p></div>
944 <div class="literalblock">
945 <div class="content">
946 <pre><code>optipng -out newfile.png &lt;=&gt; optipng -out=newfile.png
947 optipng -o3 &lt;=&gt; optipng -o 3 &lt;=&gt; optipng -o=3
948 optipng -f0,3-5 &lt;=&gt; optipng -f 0,3-5 &lt;=&gt; optipng -f=0,3-5</code></pre>
949 </div></div>
950 <div class="paragraph"><p>Rangeset arguments are cumulative.
951 For example:</p></div>
952 <div class="literalblock">
953 <div class="content">
954 <pre><code>optipng -f0 -f3-5 &lt;=&gt; optipng -f0,3-5
955 optipng -zs0 -zs1 -zs2,3 &lt;=&gt; optipng -zs0-3</code></pre>
956 </div></div>
957 </div>
958 </div>
959 </div>
960 <div class="sect1">
961 <h2 id="_extended_description">EXTENDED DESCRIPTION</h2>
962 <div class="sectionbody">
963 <div class="paragraph"><p>The PNG optimization algorithm consists of the following steps:</p></div>
964 <div class="olist arabic"><ol class="arabic">
965 <li>
966 <p>
967 Reduce the bit depth, the color type and the color palette of the
968 image.
969 This step may reduce the size of the uncompressed image, which,
970 indirectly, may reduce the size of the compressed image
971 (i.e. the size of the output PNG file).
972 </p>
973 </li>
974 <li>
975 <p>
976 Run a suite of compression methods and strategies and select the
977 compression parameters that yield the smallest output file.
978 </p>
979 </li>
980 <li>
981 <p>
982 Store all IDAT contents into a single chunk, eliminating the
983 overhead incurred by repeated IDAT headers and CRCs.
984 </p>
985 </li>
986 <li>
987 <p>
988 Set the zlib window size inside IDAT to a minimum that does not
989 affect the compression ratio, reducing the memory requirements of
990 PNG decoders.
991 </p>
992 </li>
993 </ol></div>
994 <div class="paragraph"><p>Not all of the above steps need to be executed.
995 The behavior depends on the actual input files and user options.</p></div>
996 <div class="paragraph"><p>Step 1 may be customized via the no-reduce options <strong>-nb</strong>, <strong>-nc</strong>,
997 <strong>-np</strong> and <strong>-nx</strong>.
998 Step 2 may be customized via the <strong>-o</strong> option, and may be fine-tuned
999 via the options <strong>-zc</strong>, <strong>-zm</strong>, <strong>-zs</strong> and <strong>-zw</strong>.
1000 Step 3 is always executed. Step 4 is executed only if a new IDAT is
1001 being created, and may be fine-tuned via the option <strong>-zw</strong>.</p></div>
1002 <div class="paragraph"><p>Extremely exhaustive searches are not generally expected to yield
1003 significant improvements in compression ratio, and are recommended to
1004 advanced users only.</p></div>
1005 </div>
1006 </div>
1007 <div class="sect1">
1008 <h2 id="_examples">EXAMPLES</h2>
1009 <div class="sectionbody">
1010 <div class="literalblock">
1011 <div class="content">
1012 <pre><code>optipng file.png # default speed
1013 optipng -o5 file.png # slow
1014 optipng -o7 file.png # very slow</code></pre>
1015 </div></div>
1016 </div>
1017 </div>
1018 <div class="sect1">
1019 <h2 id="_bugs">BUGS</h2>
1020 <div class="sectionbody">
1021 <div class="paragraph"><p>Lossless image reductions are not completely implemented.
1022 (This does <em>not</em> affect the integrity of the output files.)
1023 Here are the missing pieces:</p></div>
1024 <div class="ulist"><ul>
1025 <li>
1026 <p>
1027 The color palette reductions are implemented only partially.
1028 </p>
1029 </li>
1030 <li>
1031 <p>
1032 The bit depth reductions below 8, for grayscale images, are not
1033 implemented yet.
1034 </p>
1035 </li>
1036 </ul></div>
1037 <div class="paragraph"><p>Encoding of images whose total IDAT size exceeds 2GB is not currently
1038 supported.</p></div>
1039 <div class="paragraph"><p>TIFF support is limited to uncompressed, PNG-compatible
1040 (grayscale, RGB and RGBA) images.</p></div>
1041 <div class="paragraph"><p>Metadata is not imported from the external image formats.</p></div>
1042 <div class="paragraph"><p>There is no support for pipes, streams, extended file attributes or
1043 access control lists.</p></div>
1044 </div>
1045 </div>
1046 <div class="sect1">
1047 <h2 id="_see_also">SEE ALSO</h2>
1048 <div class="sectionbody">
1049 <div class="paragraph"><p><strong>png</strong>(5),
1050 <strong>libpng</strong>(3),
1051 <strong>zlib</strong>(3),
1052 <strong>pngcrush</strong>(1),
1053 <strong>pngrewrite</strong>(1).</p></div>
1054 </div>
1055 </div>
1056 <div class="sect1">
1057 <h2 id="_standards">STANDARDS</h2>
1058 <div class="sectionbody">
1059 <div class="paragraph"><p>The files produced by OptiPNG are compliant with the most recent PNG
1060 standard ("PNG Second Edition"), as well as the most recent PNG draft
1061 standard ("PNG Third Edition").</p></div>
1062 <div class="ulist"><ul>
1063 <li>
1064 <p>
1065 <em>Portable Network Graphics (PNG) Specification, Second Edition</em>.<br />
1066 W3C Recommendation 10 November 2003; ISO/IEC IS 15948:2003 (E).<br />
1067 <a href="https://www.w3.org/TR/2003/REC-PNG-20031110/">https://www.w3.org/TR/2003/REC-PNG-20031110/</a>
1068 </p>
1069 </li>
1070 <li>
1071 <p>
1072 <em>Portable Network Graphics (PNG) Specification, Third Edition</em>.<br />
1073 W3C Proposed Recommendation 15 May 2025.<br />
1074 <a href="https://www.w3.org/TR/2025/PR-png-3-20250515/">https://www.w3.org/TR/2025/PR-png-3-20250515/</a>
1075 </p>
1076 </li>
1077 </ul></div>
1078 </div>
1079 </div>
1080 <div class="sect1">
1081 <h2 id="_authors">AUTHORS</h2>
1082 <div class="sectionbody">
1083 <div class="paragraph"><p>OptiPNG is written and maintained by Cosmin Truta.</p></div>
1084 <div class="paragraph"><p>This manual page was originally written by Nelson A. de Oliveira
1085 for the Debian Project.
1086 It was later updated by Cosmin Truta, and is now part of the OptiPNG
1087 distribution.</p></div>
1088 </div>
1089 </div>
1090 </div>
1091 <div id="footnotes"><hr /></div>
1092 <div id="footer">
1093 <div id="footer-text">
1094 Last updated
1095 2025-05-20 22:39:10 EEST
1096 </div>
1097 </div>
1098 </body>
1099 </html>