1OPTIPNG(1)                  General Commands Manual                 OPTIPNG(1)
2
3
4

NAME

6       OptiPNG  -  Advanced optimization program for Portable Network Graphics
7       (PNG)
8
9

SYNOPSIS

11       optipng [-? | -h | -help]
12       optipng [options...] files...
13
14

DESCRIPTION

16       The OptiPNG program shall attempt to optimize PNG  files,  i.e.  reduce
17       their  size  to a minimum, without losing any information. In addition,
18       this  program  shall  perform  a  suite  of  auxiliary  functions  like
19       integrity checks, metadata recovery and pixmap-to-PNG conversion.
20
21       The  optimization  attempts  are  not  guaranteed to succeed. Valid PNG
22       files that cannot be  optimized  by  this  program  are  normally  left
23       intact; their size will not grow. The user may request to override this
24       default behavior.
25
26

FILES

28       The input files are raster image files encoded  either  in  PNG  format
29       (the  native format), or in an external format. The currently supported
30       external formats are GIF, BMP, PNM and TIFF.
31
32       OptiPNG processes each image file given in the command line as follows:
33
34       - If it is in PNG format:
35
36              Attempt to optimize the given file in-place. If optimization  is
37              successful,  or  if  the option -force is in effect, replace the
38              original file with its optimized version. The original  file  is
39              backed up if the option -keep is in effect.
40
41       - If it is in an external format:
42
43              Create  an  optimized  PNG version of the given file. The output
44              file name is composed from the original file name and  the  .png
45              extension.
46
47

OPTIONS

49   General options
50       -?, -h, -help
51              Show a complete summary of options.
52
53       -o level
54              Select the optimization level.
55              The  optimization  level  0 enables a set of optimization opera‐
56              tions that require minimal effort. There will be no  changes  to
57              image attributes like bit depth or color type, and no recompres‐
58              sion of existing IDAT datastreams.
59              The optimization level  1  enables  a  single  IDAT  compression
60              trial. The trial chosen is what OptiPNG thinks it's probably the
61              most effective.
62              The optimization levels 2 and higher enable multiple  IDAT  com‐
63              pression trials; the higher the level, the more trials.
64              The  behavior  and  the  default value of this option may change
65              across different program versions. Use the option -h to see  the
66              details pertaining to your specific version.
67
68       -dir directory
69              Write output file(s) to directory.
70
71       -fix   Enable  error recovery. This option has no effect on valid input
72              files.
73              The program will spend a reasonable amount of effort to  recover
74              as  much  data  as  possible, without increasing the output file
75              size, but the success cannot be generally guaranteed.  The  pro‐
76              gram  may  even  increase the file size, e.g., by reconstructing
77              missing critical data. Under this option, integrity  shall  take
78              precedence over file size.
79              When  this  option is not used, the invalid input files are left
80              unprocessed.
81
82       -force Enforce writing of a new output file.
83              This option overrides the program's decision not to  write  such
84              file,  e.g. when the PNG input is digitally signed (using dSIG),
85              or when the PNG output becomes larger than the PNG input.
86
87       -keep  Keep a backup of the modified file(s).
88              The files that use the backup names prior to the program  execu‐
89              tion are not overwritten.
90
91       -log file
92              Log  messages  to  file.  For safety reasons, file must have the
93              extension .log.
94
95       -out file
96              Write output file  to  file.   The  command  line  must  contain
97              exactly one input file.
98
99       -preserve
100              Preserve file attributes (time stamps, file access rights, etc.)
101              where applicable.
102
103       -quiet Run in quiet mode.
104              These messages are still written to the log file if  the  option
105              -log is in effect.
106
107       -simulate
108              Run  in  simulation  mode: perform the trials, but do not create
109              output files.
110
111       -snip  Cut one image out of multi-image, animation or video file(s).
112              Depending on the input format, this may be either the  first  or
113              the most relevant (e.g. the largest) image.
114
115       -v     Enable the options -verbose and -version.
116
117       -verbose
118              Run in verbose mode.
119
120       -version
121              Show copyright, version and build info.
122
123       --     Stop option switch parsing.
124
125   PNG encoding and optimization options
126       -f filters
127              Select the PNG delta filters.
128              The  filters  argument  is specified as a rangeset (e.g. -f0-5),
129              and the default filters value depends on the optimization  level
130              set by the option -o.
131              The  filter  values  0, 1, 2, 3 and 4 indicate static filtering,
132              and correspond to the standard PNG filter codes (None, Left, Up,
133              Average  and  Paeth, respectively). The filter value 5 indicates
134              adaptive filtering, whose effect is  defined  by  the  libpng(3)
135              library used by OptiPNG.
136
137       -full  Produce  a full report on IDAT.  This option might slow down the
138              trials.
139
140       -i type
141              Select the interlace type (0-1).
142              If the interlace type 0 is selected, the output image  shall  be
143              non-interlaced (i.e. progressive-scanned). If the interlace type
144              1 is selected, the output image shall be  interlaced  using  the
145              Adam7 method.
146              By default, the output shall have the same interlace type as the
147              input.
148
149       -nb    Do not apply bit depth reduction.
150
151       -nc    Do not apply color type reduction.
152
153       -np    Do not apply palette reduction.
154
155       -nx    Do not apply any lossless image reduction:  enable  the  options
156              -nb, -nc and -np.
157
158       -nz    Do not recode IDAT datastreams.
159              The  IDAT  optimization  operations that do not require recoding
160              (e.g. IDAT chunk concatenation) are still performed.
161              This option has effect on PNG input files only.
162
163       -zc levels
164              Select the zlib compression levels used in IDAT compression.
165              The levels argument is specified as a  rangeset  (e.g.  -zc6-9),
166              and  the  default levels value depends on the optimization level
167              set by the option -o.
168              The effect of this option is defined by the zlib(3) library used
169              by OptiPNG.
170
171       -zm levels
172              Select the zlib memory levels used in IDAT compression.
173              The  levels  argument  is specified as a rangeset (e.g. -zm8-9),
174              and the default levels value depends on the  optimization  level
175              set by the option -o.
176              The effect of this option is defined by the zlib(3) library used
177              by OptiPNG.
178
179       -zs strategies
180              Select the zlib compression strategies used in IDAT compression.
181              The  strategies  argument  is  specified  as  a  rangeset  (e.g.
182              -zs0-3),  and  the default strategies value depends on the opti‐
183              mization level set by the option -o.
184              The effect of this option is defined by the zlib(3) library used
185              by OptiPNG.
186
187       -zw size
188              Select  the  zlib window size (32k,16k,8k,4k,2k,1k,512,256) used
189              in IDAT compression.
190              The size argument can be specified either in bytes (e.g.  16384)
191              or  kilobytes  (e.g.  16k). The default size value is set to the
192              lowest window size that yields an  IDAT  output  as  big  as  if
193              yielded by the value 32768.
194              The effect of this option is defined by the zlib(3) library used
195              by OptiPNG.
196
197   Notes
198       Options may come in any order (except for --), before, after, or alter‐
199       nating  with  file  names. Option names are case-insensitive and may be
200       abbreviated to their shortest unique prefix.
201
202       Some options may have arguments that follow the option name,  separated
203       by whitespace or the equal sign ('='). If the option argument is a num‐
204       ber or a rangeset, the separator may be omitted. For example:
205
206              -out newfile.png  <=>  -out=newfile.png
207              -o3  <=>  -o 3  <=>  -o=3
208              -f0,3-5  <=>  -f 0,3-5  <=>  -f=0,3-5
209
210       Rangeset arguments are cumulative; e.g.
211
212              -f0 -f3-5  <=>  -f0,3-5
213              -zs0 -zs1 -zs2-3  <=>  -zs0,1,2,3  <=>  -zs0-3
214
215

EXTENDED DESCRIPTION

217       The PNG optimization algorithm consists of the following steps:
218
219       1.  Reduce the bit depth, the color type and the color palette  of  the
220           image.   This  step  may reduce the size of the uncompressed image,
221           which, indirectly, may reduce the  size  of  the  compressed  image
222           (i.e. the size of the output PNG file).
223
224       2.  Run  a  suite  of compression methods and strategies and select the
225           compression parameters that yield the smallest output file.
226
227       3.  Store all IDAT contents into a single chunk, eliminating the  over‐
228           head incurred by repeated IDAT headers and CRCs.
229
230       4.  Set  the  zlib  window  size inside IDAT to a mininum that does not
231           affect the compression ratio, reducing the memory  requirements  of
232           PNG decoders.
233
234       Not all of the above steps need to be executed. The behavior depends on
235       the actual input files and user options.
236
237       Step 1 may be customized via the no-reduce options -nb,  -nc,  -np  and
238       -nx.  Step 2 may be customized via the -o option, and may be fine-tuned
239       via the options -zc, -zm, -zs and -zw. Step 3 is always executed.  Step
240       4  is  executed  only  if a new IDAT is being created, and may be fine-
241       tuned via the option -zw.
242
243       Extremely exhaustive searches are not generally expected to yield  sig‐
244       nificant  improvements  in  compression  ratio,  and are recommended to
245       advanced users only.
246
247

EXAMPLES

249       optipng file1.png file2.gif file3.tif
250
251       optipng -o5 file1.png file2.gif file3.tif
252
253       optipng -i1 -o7 -v -full -sim experiment.png
254
255

BUGS

257       Lossless image reductions are not completely implemented.   (This  does
258       NOT  affect  the  integrity of the output files.)  Here are the missing
259       pieces:
260
261              - The color palette reductions are implemented only partially.
262              - The bit depth reductions below 8, for  grayscale  images,  are
263              not implemented yet.
264
265       TIFF support is limited to uncompressed, PNG-compatible (grayscale, RGB
266       and RGBA) images.
267
268       Metadata is not imported from the external image formats.
269
270       There is no support for pipes or streams.
271
272

SEE ALSO

274       png(5), libpng(3), zlib(3), pngcrush(1), pngrewrite(1).
275
276

STANDARDS

278       The files produced by OptiPNG are compliant with PNG-2003:
279       Glenn Randers-Pehrson et al.  Portable Network Graphics (PNG)  Specifi‐
280       cation, Second Edition.
281       W3C Recommendation 10 November 2003; ISO/IEC IS 15948:2003 (E).
282       http://www.w3.org/TR/PNG/
283
284

AUTHOR

286       OptiPNG is written and maintained by Cosmin Truta.
287
288       This  manual  page  was originally written by Nelson A. de Oliveira for
289       the Debian Project. It was later updated by Cosmin Truta,  and  is  now
290       part of the OptiPNG distribution.
291
292
293
294OptiPNG version 0.6.4            2010-March-14                      OPTIPNG(1)
Impressum