Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fallback to local binaries for windows system

* added optipng-8d and optipng-0.7.1 into vendor/
* necessary change to img task code to work on windows
* to test back on posix

This closes #25
  • Loading branch information...
commit a5566f03b90df3ce7c2c79c12a9abcea6f16c956 1 parent f3d4bc2
@mklabs authored
View
1  tasks/h5bp.js
@@ -107,7 +107,6 @@ module.exports = function(grunt) {
grunt.registerHelper('min_max_stat', function(min, max) {
min = typeof min === 'string' ? fs.statSync(min) : min;
max = typeof max === 'string' ? fs.statSync(max) : max;
- console.log(max.size, min.size);
grunt.log.writeln('Uncompressed size: ' + String(max.size).green + ' bytes.');
grunt.log.writeln('Compressed size: ' + String(min.size).green + ' bytes minified.');
});
View
83 tasks/img.js
@@ -20,6 +20,7 @@ var fs = require('fs'),
// }
//
+var win32 = process.platform === 'win32';
module.exports = function(grunt) {
@@ -60,70 +61,54 @@ module.exports = function(grunt) {
opts = opts || {};
cb = cb || function() {};
- var args = opts.args ? opts.args : [];
- args = args.concat(files);
- if(!files.length) return cb();
- grunt.log.writeln('Running optipng... ' + grunt.log.wordlist(files));
- var child = grunt.utils.spawn({
- cmd: '/usr/local/bin/optipng',
- args: args
- }, function() {});
-
- var error = function error(code) {
- if(!code) return cb();
- grunt.verbose.or.writeln();
- grunt.log.write('Running optipng...').error();
- if (code === 127) {
- grunt.log.errorlns(
- 'In order for this task to work properly, optipng must be ' +
- 'installed and in the system PATH (if you can run "optipng" at' +
- ' the command line, this task should work)'
- );
- grunt.warn('optipng not found.', code);
- } else {
- grunt.warn('optipng exited unexpectedly with exit code ' + code + '.', code);
- }
-
- return cb(false);
- };
-
- child.stdout.pipe(process.stdout);
- child.stderr.pipe(process.stderr);
-
- child.on('exit', error).on('error', error);
-
+ grunt.helper('which', 'optipng', function(err, cmdpath) {
+ if(err) return grunt.helper('not installed', 'optipng', cb);
+ var args = opts.args ? opts.args : [];
+ args = args.concat(files);
+ if(!files.length) return cb();
+ grunt.log.writeln('Running optipng... ' + grunt.log.wordlist(files));
+ var optipng = grunt.utils.spawn({
+ cmd: cmdpath,
+ args: args
+ }, function() {});
+
+ optipng.stdout.pipe(process.stdout);
+ optipng.stderr.pipe(process.stderr);
+ optipng.on('exit', function(code) {
+ if(code) grunt.warn('optipng exited unexpectedly with exit code ' + code + '.', code);
+ cb();
+ });
+ });
});
grunt.registerHelper('jpegtran', function(files, opts, cb) {
opts = opts || {};
cb = cb || function() {};
- opts.args = opts.args ? opts.args : ['-copy', 'none', '-optimize'];
+ opts.args = opts.args ? opts.args : ['-copy', 'none', '-optimize', '-outfile', 'jpgtmp.jpg'];
- which('jpegtran', function(err, cmdpath) {
+ grunt.helper('which', 'jpegtran', function(err, cmdpath) {
if(err) return grunt.helper('not installed', 'jpegtran', cb);
(function run(file) {
if(!file) return cb();
- console.log(opts.args);
- var child = grunt.utils.spawn({
+ grunt.log.subhead('** Processing: ' + file);
+ var jpegtran = grunt.utils.spawn({
cmd: cmdpath,
args: opts.args.concat(file)
}, function() {});
- var jpgtmp = fs.createWriteStream('jpgtmp.jpg');
- child.stdout.pipe(jpgtmp).on('close', function() {
+ jpegtran.stdout.pipe(process.stdout);
+ jpegtran.stderr.pipe(process.stderr);
+
+ jpegtran.on('exit', function(code) {
+ if(code) return grunt.warn('jpgtran exited unexpectedly with exit code ' + code + '.', code);
// output some size info about the file
grunt.helper('min_max_stat', 'jpgtmp.jpg', file);
-
// copy the temporary optimized jpg to original file
fs.createReadStream('jpgtmp.jpg')
.pipe(fs.createWriteStream(file)).on('close', function() {
run(files.shift());
});
});
- child.stderr.pipe(process.stderr);
- child.on('exit', function(code) {
- if(code) grunt.warn('jpg exited unexpectedly with exit code ' + code + '.', code);
- });
}(files.shift()));
});
@@ -137,9 +122,19 @@ module.exports = function(grunt) {
'installed and in the system PATH (if you can run ":cmd" at',
'the command line, this task should work)'
].join(' ').replace(/:cmd/g, cmd));
- grunt.log.writeln('Skiping ' + cmd + ' task');
+ grunt.log.subhead('Skiping ' + cmd + ' task');
if(cb) cb();
});
+ // **which** helper, wrapper to isaacs/which package plus some fallback logic
+ // specifically for the win32 binaries in vendor/ (optipng.exe, jpegtran.exe)
+ grunt.registerHelper('which', function(cmd, cb) {
+ if(!win32 || !/optipng|jpegtran/.test(cmd)) return which(cmd, cb);
+
+ var cmdpath = cmd === 'optipng' ? '../vendor/optipng-0.7.1-win32/optipng.exe' :
+ '../vendor/jpegtran-8d/jpegtran.exe';
+
+ cb(null, path.join(__dirname, cmdpath));
+ });
};
View
BIN  vendor/jpegtran-8d/jpegtran.exe
Binary file not shown
View
2  vendor/optipng-0.7.1-win32/OptiPNG.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=http://optipng.sourceforge.net/
View
25 vendor/optipng-0.7.1-win32/doc/authors.txt
@@ -0,0 +1,25 @@
+# OptiPNG version 0.7.1
+# Copyright (C) 2001-2012 Cosmin Truta and the Contributing Authors.
+# See the accompanying LICENSE file for details.
+#
+# A Contributing Author is a person or company who contributed code that
+# is now part of OptiPNG.
+#
+# For the purpose of copyright and licensing, this is the official list
+# of Contributing Authors, in alphabetic order.
+
+Adam Ciarcinski
+Brian McQuade
+Elias Pipping
+Fabien Barbier
+Maciej Pilichowski
+Matthew Fearnley
+Nelson A. de Oliveira
+Niels de Koning
+Petr Gajdos
+Piotr Bandurski
+Ramona C. Truta
+Sebastian Pipping
+Stefan Br�ns
+Till Maas
+Ville Skytt�
View
345 vendor/optipng-0.7.1-win32/doc/history.txt
@@ -0,0 +1,345 @@
+
+OptiPNG - Revision history
+==========================
+
+Legend
+------
+++ Added or improved performance-related feature
+ (might improve compression ratio or processing speed).
+ + Added or improved feature.
+ - Removed feature.
+ ! Fixed bug.
+!! Fixed critical bug
+ (crash, data/metadata loss or security hazard).
+ * Other modification (e.g. architectural improvement).
+
+Version 0.7.1 19-mar-2012
+-------------
+!! Fixed a regression in the reduction of palette-encoded grayscale
+ images. This regression was introduced in version 0.7.
+ (Thanks to Adam Ciarcinski for the fix.)
+
+Version 0.7 29-feb-2012
+-----------
+ * Upgraded libpng to version 1.4.9.
+ * Upgraded zlib to version 1.2.6-optipng.
+!! Resolved a rarely-occurring out-of-bounds memory access error in
+ Z_RLE, by upgrading zlib. (Thanks to Christopher Wichura for the
+ report, and thanks to Mark Adler for fixing zlib.)
+ + Added the popularly-requested option -strip.
+ The only suboption currently supported is "-strip all".
+ + Added the option -clobber.
+ (Thanks in part to Maciej Pilichowski for the contribution.)
+ + Added the option -backup, as an alias of -keep.
+ + Added the option -silent, as an alias of -quiet.
+ - Deprecated the option -log.
+ * Changed the activity display output from STDOUT to STDERR.
+ + Allowed the option -preserve to save high-resolution timestamps
+ on Unix, if the POSIX-1.2008 API is available. This feature was
+ previously available on Windows only.
+ ! Fixed a minor precision error in the display of file size percents.
+ ! Fixed a memory leak that occurred when reading broken GIF images.
+ ! Fixed various build issues.
+ (Thanks to Sebastian Pipping and Ville Skytta for the fixes.)
+ * Resolved all remaining compatibility issues with libpng-1.5.
+ (Thanks in part to Adam Ciarcinski for the contribution.)
+ * Added build support for clang.
+ * Reorganized the source directory structure.
+
+Version 0.6.5 24-jan-2011
+-------------
+ * Upgraded libpng to version 1.4.5-optipng [private]
+ * Upgraded zlib to version 1.2.5-optipng [private]
+!! Fixed the I/O states (in libpng 1.4.5);
+ they caused incorrect file reads in some rare cases.
+ (Thanks to [M*A*S*H] and Dmitry Marakasov for the report.)
+!! Fixed processing of PNG files with chunks of size 0.
+ (Thanks to Matthew Fearnley for the report.)
+ ! Fixed a display error in the TIFF import.
+ (Thanks to Piotr Bandurski for the fix.)
+ + Improved checking of the arguments of -f, -zc, -zm and -zs.
+ - Removed quirks from the rangeset option argument syntax.
+ ! Fixed a build issue under the system-supplied libpng-1.4.
+ (Thanks to Petr Gajdos for the fix.)
+ * Resolved forward-compatibility issues regarding libpng-1.5;
+ however, the system-supplied libpng-1.5 is not yet supported.
+ * Added various enhancements to the configure+make build system.
+ (Thanks in part to Elias Pipping and Dmitri Zubko.)
+
+Version 0.6.4 14-mar-2010
+-------------
+ * Upgraded libpng to version 1.4.1-optipng [private]
+ * Upgraded zlib to version 1.2.4-optipng [private]
+ + Added the option -nx.
+ * Clarified the behavior of -nz and the relation between -nz and -o0.
+ + Added a filesystem check (resolving normalized paths, symlinks, etc.)
+ to better detect when the output overwrites the input.
+ + Enabled automatic wildcard expansion (i.e. globbing) on Win64.
+ ! Fixed a Unicode build issue on Windows.
+ (Thanks to Fabien Barbier for the fix.)
+
+Version 0.6.3 18-may-2009
+-------------
+ * Upgraded libpng to version 1.2.36-optipng [private]
+!! Fixed a use-after-free error in the GIF reader.
+ (Thanks to Roy Tam for the report, and to Bryan McQuade for the fix.)
+ ! Flushed the output log to display the current trial in real time.
+ This only worked on Windows in the previous version.
+ (Thanks to Vincent Lefevre for the fix.)
+ ! Fixed an error in reporting unrecognized file formats.
+ (Thanks to [LaughingMan] for the report.)
+ - Removed the requirement to "fix" TIFF files that contain unrecognized
+ metadata. (Thanks to Piotr Bandurski for the suggestion.)
+ * Simplified the option abbreviation rules. Option names can now be
+ abbreviated to their shortest unique prefix, as in X11 applications.
+
+Version 0.6.2 9-nov-2008
+-------------
+ * Upgraded libpng to version 1.2.33-optipng [private]
+++ Put back a speed optimization, accidentally removed in version 0.6,
+ allowing singleton trials (-o1) to be bypassed in certain conditions.
+!! Fixed an array overflow in the BMP reader.
+!! Fixed the loss of private chunks under the -snip option.
+ + Produced a more concise on-screen output in the non-verbose mode.
+ (Thanks to Vincent Lefevre for the contribution.)
+ * Added a programming interface to the optimization engine, in order
+ to facilitate the development of PNG-optimizing GUI apps and plugins.
+
+Version 0.6.1 20-jul-2008
+-------------
+ * Upgraded cexcept to version 2.0.1.
+ + Added a configure script, to be used instead of unix-secure.mak.
+ ! Fixed a build issue that occurred when using libpng from the system.
+ (Thanks to Nelson A. de Oliveira for the report.)
+ ! Fixed processing when image reduction yields an output larger than
+ the original. (Thanks to Michael Krishtopa for the report.)
+ ! Fixed behavior of -preserve.
+ (Thanks to Bill Koch for the report.)
+ - Removed displaying of partial progress when abandoning IDATs under
+ the -v option. The percentages displayed were not very accurate.
+
+Version 0.6 15-jun-2008
+-----------
+ * Upgraded libpng to version 1.2.29-optipng [private]
+++ Implemented grayscale(alpha)-to-palette reductions.
+++ Improved conversion of bKGD info during RGB-to-palette reductions.
+ (Thanks to Matthew Fearnley for the contribution.)
+!! Fixed conversion of bKGD and tRNS during 16-to-8-bit reductions.
+ (Thanks to Matthew Fearnley for the report.)
+ + Added support for compressed BMP (incl. PNG-compressed BMP, you bet!)
+ + Improved the speed of reading raw PNM files.
+ + Recognized PNG digital signatures (dSIG) and disabled optimization
+ in their presence, to preserve their integrity.
+ + Allowed the user to enforce the optimization of dSIG'ed files.
+ + Recognized APNG animation files and disabled reductions to preserve
+ their integrity.
+ + Added the -snip option, to allow the user to "snip" one image out of
+ a multi-image file, such as animated GIF, multi-page TIFF, or APNG.
+ (Thanks to [LaughingMan] for the suggestion.)
+ + Improved recovery of PNG files with incomplete IDAT.
+!! Fixed a crash triggered by the use of -log on some platforms.
+ (Thanks to Stefan Bruns for the fix.)
+ ! Fixed behavior of -out and -dir when the input is already optimized.
+ (Thanks to Christian Davideck for the report.)
+ * Provided more detailed image information at the start of processing.
+ * Provided a more detailed summary at the end of processing, under the
+ presence of the -v option and/or the occurrence of exceptional events.
+
+Version 0.5.5 28-jan-2007
+-------------
+ * Upgraded libpng to version 1.2.15-optipng [private]
+++ Used a previously-missed RGB-to-palette reduction opportunity
+ for images containing 256 distinct colors.
+ (Thanks to Joachim Kluge for the report.)
+!! Fixed conversion of bKGD info during RGB-to-palette reductions.
+ (Thanks to Matthew Fearnley for the report.)
+ ! Fixed pre-computation of iterations.
+ (Thanks to Matthew Fearnley for the report.)
+ ! Eliminated a false alarm when processing RGB images with tRNS
+ in Unix-secure mode. (Thanks to Till Maas for the report, and
+ thanks to Nelson A. de Oliveira for the fix.)
+ ! Fixed behavior of -out and -dir when changing interlacing.
+ (Thanks to Martin Packman for the report.)
+ ! Fixed the behavior of "-dir [DRIVE]:" on Windows.
+
+Version 0.5.4 11-aug-2006
+-------------
+ + Added user options -out and -dir, to specify the name of
+ the output file or directory.
+ (Thanks to Alexander Lucas for the suggestion.)
+ * Added support for builds based on the system-supplied libpng.
+ (Thanks to Nelson A. de Oliveira for the valuable help.)
+
+Version 0.5.3 23-jul-2006
+-------------
+ * Upgraded libpng to version 1.2.12-optipng [private]
+ + Implemented basic support for TIFF (grayscale, RGB and RGBA,
+ uncompressed).
+++ Avoided the redundant trial when the search space is singular
+ (e.g. when running "optipng -o1 example.tif").
+ + Prevented accidental file corruption when using option "-log".
+ ! Fixed (again) a small typo in the online help.
+
+Version 0.5.2 7-may-2006
+-------------
+ + Improved handling of inexact PNM-to-PNG conversions.
+ ! Fixed a typo that was breaking the build on some Unix platforms.
+ (Thanks to Aaron Reitz for the report.)
+
+Version 0.5.1 30-apr-2006
+-------------
+++ Implemented bit depth reduction for palette images.
+ * Upgraded libpng to version 1.2.10-optipng [private]
+ + Improved the BMP support.
+ + Added a Unix man page.
+ (Thanks to Nelson A. de Oliveira for the contribution.)
+ + Allowed abbreviation of command-line options.
+ + Changed user option -log to accept a file name as an argument.
+ * Changed user option -no to -simulate.
+ ! Fixed an error in handling .bak files on Unix.
+ (Thanks to Adam Szojda and Nelson A. de Oliveira for the report.)
+ ! Fixed a small typo in the help screen.
+ (Thanks to A. Costa and Nelson A. de Oliveira for the report.)
+
+Version 0.5 14-jan-2006
+-----------
+++ Added pngxtern, a libpng add-on for external image format
+ support: BMP (uncompressed), GIF, PNM.
+ (This was incorporated from OptiPNG-Plus.)
+++ Implemented RGB(A)-to-palette reductions.
+ * Upgraded zlib to version 1.2.3-optipng [private]
+ * Upgraded libpng to version 1.2.8-optipng [private]
+ + If trials are ended prematurely, detailed progression is only
+ reported under the user option -v.
+ - Removed reporting of some IDAT sizes that exceeded the optimum.
+ (This was NOT a bug, but a "feature" that confused some users.)
+ ! Fixed an RGB-to-gray reduction problem that occurred under some
+ specific background colors.
+ * Added support for builds based on the system-supplied zlib.
+ (Thanks to Nelson A. de Oliveira for the suggestion.)
+ * Modified LICENSE. It is now a verbatim spell of the zlib license.
+
+Version 0.4.8 10-may-2005
+-------------
+ * Upgraded libpng to version 1.0.18-optipng [private]
+!! Fixed a palette-to-gray reduction problem that occurred when an
+ RGB triple had both an alpha below max, and an alpha equal to max.
+ (Thanks to Nicolas Le Gland for the report.)
+ + Packed the Windows executable using UPX.
+ (Thanks to [Warriant] for the suggestion.)
+
+Version 0.4.7 30-oct-2004
+-------------
+!! Fixed a palette-to-gray reduction problem that occurred when
+ having more than one alpha value per RGB triple.
+ (Thanks to Larry Hastings for the report.)
+ ! Fixed the progress display, when processing very large images.
+ + Displayed the image info at the beginning of processing.
+++ Reduced the IDAT buffer size, allowing abandoned trials to
+ terminate earlier in some circumstances.
+ + Implemented error recovery, when PLTE is too small, and/or
+ tRNS is too large.
+
+Version 0.4.6 25-oct-2004
+-------------
+ * Upgraded zlib to version 1.2.2-optipng [private]
+ * Upgraded libpng to version 1.0.17-optipng [private]
+ This provides safe handling of some ill-formed PNG images.
+ + Rewrote makefiles.
+ + Added project workspace to build under Visual C++ 6.0,
+ integrated with memory leak detection.
+++ Implemented a premature termination of trials, in the moment
+ when IDAT grows beyond the smallest size previously achieved.
+ (Thanks to Larry Hastings for the idea.)
+ + Changed the order of trials, to perform the trials that are
+ more likely to yield a smaller IDAT, at the beginning.
+ + Added user option -full to avoid the premature termination of
+ trials; useful for debugging.
+
+Version 0.4.5 31-may-2004
+-------------
+ * Upgraded zlib to version 1.2.1.f-cos2 [private]
+ * Upgraded libpng to version 1.0.15-cos2 [private]
+ * Changed user option -nx to -nz.
+ + Added user option to preserve file attributes (file mode,
+ time stamp, etc.) when applicable.
+ (Thanks to Nehal Mistry for the suggestion.)
+ ! Fixed an incorrect initialization of zlib window bits.
+ ! Displayed an error message when the search space was invalid.
+!! Fixed a palette reduction problem for bit depths below 8.
+ ! Eliminated memory leaks.
+ (Thanks to Niels de Koning for the help.)
+
+Version 0.4.4 20-nov-2003
+-------------
+ * Upgraded zlib to version 1.2.1
+++ Added support for the Z_RLE strategy.
+
+Version 0.4.3 12-aug-2003
+-------------
+ ! Fixed a reduction problem that caused an assertion failure.
+ (Thanks to Dimitri Papadopoulos for the report.)
+
+Version 0.4.2 30-jun-2003
+-------------
+++ Enhanced the support for palette size reductions:
+ trailing sterile palette entries are removed even when
+ the bit depth is below 8.
+ ! Enforced recompression when the new IDAT has the same size,
+ but other chunks have been reduced.
+ + Displayed the IDAT size difference as a percentage.
+ (Thanks to Nehal Mistry for the suggestion.)
+
+Version 0.4.1 19-may-2003
+-------------
+ ! Fixed the removal of trailing sterile palette entries.
+
+Version 0.4 12-may-2003
+-----------
+++ Added support for palette-to-gray reductions.
+++ Added partial support for palette size reductions.
+ ! Fixed the reporting of invalid command-line options.
+ ! Eliminated a spurious warning when the zlib window size
+ is set to 256.
+
+Version 0.3.2 11-mar-2003
+-------------
+ + Added support for updating sBIT during reductions.
+ ! Fixed the reduction of the alpha channel.
+
+Version 0.3.1 25-feb-2003
+-------------
+ ! Fixed the encoding of interlaced images when they become
+ larger than the input.
+ (Thanks to James H. Cloos, Jr. for the report.)
+ + Added the HISTORY document (this file).
+
+Version 0.3 24-feb-2003
+-----------
+This is the first public release of OptiPNG.
+++ Added support for iterating through zlib memory levels.
+++ Added support for collapsing IDAT, avoiding calls to
+ png_set_compression_buffer_size().
+ This reduces the memory requirements.
+++ Added support for lossless reduction of the image type:
+ RGB[A] -> G[A], RGBA -> RGB, GA -> G
+ + Added many user options.
+ + Added documentation.
+
+Version 0.2 27-dec-2001
+-----------
+ + Added support for optimization level presets.
+ + Added user option for changing the interlacing.
+
+Version 0.1 17-dec-2001
+-----------
+ + Added support for chunk I/O status annotation.
+ This improves the speed of OptiPNG significantly.
+ * Structured exception handling is provided by cexcept.
+
+Version 0.0.1 10-dec-2001
+-------------
+This is the very first version of OptiPNG.
+It compresses IDAT repeatedly, iterating through zlib compression
+and strategy levels, and PNG filters.
+
View
23 vendor/optipng-0.7.1-win32/doc/license.txt
@@ -0,0 +1,23 @@
+
+Copyright (C) 2001-2012 Cosmin Truta and the Contributing Authors.
+For the purpose of copyright and licensing, the list of Contributing
+Authors is available in the accompanying AUTHORS file.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the author(s) be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and must not
+ be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source distribution.
+
View
662 vendor/optipng-0.7.1-win32/doc/optipng.man.html
@@ -0,0 +1,662 @@
+<!-- Creator : groff version 1.20.1 -->
+<!-- CreationDate: Mon Mar 19 20:19:00 2012 -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta name="Content-Style" content="text/css">
+<style type="text/css">
+ p { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ table { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ h1 { text-align: center }
+</style>
+<title>OPTIPNG</title>
+
+</head>
+<body>
+
+<h1 align="center">OPTIPNG</h1>
+
+<hr>
+
+
+<h2>NAME
+<a name="NAME"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>OptiPNG</b>
+&minus; Optimize Portable Network Graphics files</p>
+
+<h2>SYNOPSIS
+<a name="SYNOPSIS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>optipng</b>
+[<b>&minus;?</b> | <b>&minus;h</b> | <b>&minus;help</b>]
+<b><br>
+optipng</b> [<i>options...</i>] <i>files...</i></p>
+
+<h2>DESCRIPTION
+<a name="DESCRIPTION"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">The
+<b>OptiPNG</b> program shall attempt to <i>optimize</i> PNG
+files, i.e. reduce their size to a minimum, without losing
+semantic information. In addition, this program shall
+perform a suite of auxiliary functions like integrity
+checks, metadata recovery and pixmap-to-PNG conversion.</p>
+
+<p style="margin-left:11%; margin-top: 1em">The
+optimization attempts are not guaranteed to succeed. Valid
+PNG files that cannot be optimized by this program are
+normally left intact; their size will not grow. The user may
+request to override this default behavior.</p>
+
+<h2>FILES
+<a name="FILES"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">The input files
+are raster image files encoded either in PNG format (the
+native format), or in an external format. The currently
+supported external formats are GIF, BMP, PNM and TIFF.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>OptiPNG</b>
+processes each image file given in the command line as
+follows:</p>
+
+<p style="margin-left:11%; margin-top: 1em">&minus; If the
+image is in PNG format:</p>
+
+<p style="margin-left:22%; margin-top: 1em">Attempts to
+optimize the given file in-place. If optimization is
+successful, or if the option <b>&minus;force</b> is enabled,
+replaces the original file with its optimized version. The
+original file is backed up if the option <b>&minus;keep</b>
+is enabled.</p>
+
+<p style="margin-left:11%; margin-top: 1em">&minus; If the
+image is in an external format:</p>
+
+<p style="margin-left:22%; margin-top: 1em">Creates an
+optimized PNG version of the given file. The output file
+name is composed from the original file name and the
+<tt>.png</tt> extension.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Existing files
+are <i>not</i> overwritten, unless the option
+<b>&minus;clobber</b> is enabled.</p>
+
+<h2>OPTIONS
+<a name="OPTIONS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>General
+options <br>
+&minus;?</b>, <b>&minus;h</b>, <b>&minus;help</b></p>
+
+<p style="margin-left:22%;">Show a complete summary of
+options.</p>
+
+<p style="margin-left:11%;"><b>&minus;backup</b>,
+<b>&minus;keep</b></p>
+
+<p style="margin-left:22%;">Keep a backup of the modified
+files.</p>
+
+<p style="margin-left:11%;"><b>&minus;clobber</b></p>
+
+<p style="margin-left:22%;">Overwrite the existing output
+and backup files. <br>
+Under this option, if the option <b>&minus;backup</b> is not
+enabled, the old backups of the overwritten files are
+deleted.</p>
+
+<p style="margin-left:11%;"><b>&minus;dir</b>
+<i>directory</i></p>
+
+<p style="margin-left:22%;">Write the output files to
+<i>directory</i>.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="6%">
+
+
+<p><b>&minus;fix</b></p></td>
+<td width="5%"></td>
+<td width="78%">
+
+
+<p>Enable error recovery. This option has no effect on
+valid input files.</p></td></tr>
+</table>
+
+<p style="margin-left:22%;">The program will spend a
+reasonable amount of effort to recover as much data as
+possible, without increasing the output file size, but the
+success cannot be generally guaranteed. The program may even
+increase the file size, e.g., by reconstructing missing
+critical data. Under this option, integrity shall take
+precedence over file size. <br>
+When this option is not used, the invalid input files are
+left unprocessed.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="9%">
+
+
+<p style="margin-top: 1em"><b>&minus;force</b></p></td>
+<td width="2%"></td>
+<td width="56%">
+
+
+<p style="margin-top: 1em">Enforce writing of a new output
+file.</p> </td>
+<td width="22%">
+</td></tr>
+</table>
+
+<p style="margin-left:22%;">This option overrides the
+program&rsquo;s decision not to write such file, e.g. when
+the PNG input is digitally signed (using dSIG), or when the
+PNG output becomes larger than the PNG input.</p>
+
+<p style="margin-left:11%;"><b>&minus;log</b>
+<i>file</i></p>
+
+<p style="margin-left:22%;">Log messages to <i>file</i>.
+For safety reasons, <i>file</i> must have the extension
+<tt>.log</tt>. <br>
+This option is deprecated and will be removed eventually.
+Use shell redirection.</p>
+
+<p style="margin-left:11%;"><b>&minus;out</b>
+<i>file</i></p>
+
+<p style="margin-left:22%;">Write output file to
+<i>file</i>. The command line must contain exactly one input
+file.</p>
+
+<p style="margin-left:11%;"><b>&minus;preserve</b></p>
+
+<p style="margin-left:22%;">Preserve file attributes (time
+stamps, file access rights, etc.) where applicable.</p>
+
+<p style="margin-left:11%;"><b>&minus;quiet</b>,
+<b>&minus;silent</b></p>
+
+<p style="margin-left:22%;">Run in quiet mode. <br>
+The messages are still written to the log file if the option
+<b>&minus;log</b> is enabled.</p>
+
+<p style="margin-left:11%;"><b>&minus;simulate</b></p>
+
+<p style="margin-left:22%;">Run in simulation mode: perform
+the trials, but do not create output files.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p><b>&minus;v</b></p></td>
+<td width="8%"></td>
+<td width="63%">
+
+
+<p>Enable the options <b>&minus;verbose</b> and
+<b>&minus;version</b>.</p> </td>
+<td width="15%">
+</td></tr>
+</table>
+
+<p style="margin-left:11%;"><b>&minus;verbose</b></p>
+
+<p style="margin-left:22%;">Run in verbose mode.</p>
+
+<p style="margin-left:11%;"><b>&minus;version</b></p>
+
+<p style="margin-left:22%;">Show copyright, version and
+build info.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p><b>&minus;&minus;</b></p></td>
+<td width="8%"></td>
+<td width="41%">
+
+
+<p>Stop option switch parsing.</p></td>
+<td width="37%">
+</td></tr>
+</table>
+
+<p style="margin-left:11%; margin-top: 1em"><b>PNG encoding
+and optimization options <br>
+&minus;o</b> <i>level</i></p>
+
+<p style="margin-left:22%;">Select the optimization level.
+<br>
+The optimization level 0 enables a set of optimization
+operations that require minimal effort. There will be no
+changes to image attributes like bit depth or color type,
+and no recompression of existing IDAT datastreams. <br>
+The optimization level 1 enables a single IDAT compression
+trial. The trial chosen is what <b>OptiPNG</b> <i>thinks</i>
+it&rsquo;s probably the most effective. <br>
+The optimization levels 2 and higher enable multiple IDAT
+compression trials; the higher the level, the more trials.
+<br>
+The behavior and the default value of this option may change
+across different program versions. Use the option
+<b>&minus;h</b> to see the details pertaining to your
+specific version.</p>
+
+<p style="margin-left:11%;"><b>&minus;f</b>
+<i>filters</i></p>
+
+<p style="margin-left:22%;">Select the PNG delta filters.
+<br>
+The <i>filters</i> argument is specified as a rangeset (e.g.
+<b>&minus;f0&minus;5</b>), and the default <i>filters</i>
+value depends on the optimization level set by the option
+<b>&minus;o</b>. <br>
+The filter values 0, 1, 2, 3 and 4 indicate static
+filtering, and correspond to the standard PNG filter codes
+(<i>None</i>, <i>Left</i>, <i>Up</i>, <i>Average</i> and
+<i>Paeth</i>, respectively). The filter value 5 indicates
+adaptive filtering, whose effect is defined by the
+<b>libpng</b>(3) library used by <b>OptiPNG</b>.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="7%">
+
+
+<p><b>&minus;full</b></p></td>
+<td width="4%"></td>
+<td width="78%">
+
+
+<p>Produce a full report on IDAT. This option might slow
+down the trials.</p></td></tr>
+</table>
+
+<p style="margin-left:11%;"><b>&minus;i</b> <i>type</i></p>
+
+<p style="margin-left:22%;">Select the interlace type
+(0&minus;1). <br>
+If the interlace type 0 is selected, the output image shall
+be non-interlaced (i.e. progressive-scanned). If the
+interlace type 1 is selected, the output image shall be
+interlaced using the <i>Adam7</i> method. <br>
+By default, the output shall have the same interlace type as
+the input.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+
+<p><b>&minus;nb</b></p></td>
+<td width="7%"></td>
+<td width="78%">
+
+
+<p>Do not apply bit depth reduction.</p></td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+
+<p><b>&minus;nc</b></p></td>
+<td width="7%"></td>
+<td width="78%">
+
+
+<p>Do not apply color type reduction.</p></td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+
+<p><b>&minus;np</b></p></td>
+<td width="7%"></td>
+<td width="78%">
+
+
+<p>Do not apply palette reduction.</p></td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+
+<p><b>&minus;nx</b></p></td>
+<td width="7%"></td>
+<td width="78%">
+
+
+<p>Do not apply any lossless image reduction: enable the
+options <b>&minus;nb</b>, <b>&minus;nc</b> and
+<b>&minus;np</b>.</p> </td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="4%">
+
+
+<p><b>&minus;nz</b></p></td>
+<td width="7%"></td>
+<td width="78%">
+
+
+<p>Do not recode IDAT datastreams.</p></td></tr>
+</table>
+
+<p style="margin-left:22%;">The IDAT optimization
+operations that do not require recoding (e.g. IDAT chunk
+concatenation) are still performed. <br>
+This option has effect on PNG input files only.</p>
+
+<p style="margin-left:11%;"><b>&minus;zc</b>
+<i>levels</i></p>
+
+<p style="margin-left:22%;">Select the zlib compression
+levels used in IDAT compression. <br>
+The <i>levels</i> argument is specified as a rangeset (e.g.
+<b>&minus;zc6&minus;9</b>), and the default <i>levels</i>
+value depends on the optimization level set by the option
+<b>&minus;o</b>. <br>
+The effect of this option is defined by the <b>zlib</b>(3)
+library used by <b>OptiPNG</b>.</p>
+
+<p style="margin-left:11%;"><b>&minus;zm</b>
+<i>levels</i></p>
+
+<p style="margin-left:22%;">Select the zlib memory levels
+used in IDAT compression. <br>
+The <i>levels</i> argument is specified as a rangeset (e.g.
+<b>&minus;zm8&minus;9</b>), and the default <i>levels</i>
+value depends on the optimization level set by the option
+<b>&minus;o</b>. <br>
+The effect of this option is defined by the <b>zlib</b>(3)
+library used by <b>OptiPNG</b>.</p>
+
+<p style="margin-left:11%;"><b>&minus;zs</b>
+<i>strategies</i></p>
+
+<p style="margin-left:22%;">Select the zlib compression
+strategies used in IDAT compression. <br>
+The <i>strategies</i> argument is specified as a rangeset
+(e.g. <b>&minus;zs0&minus;3</b>), and the default
+<i>strategies</i> value depends on the optimization level
+set by the option <b>&minus;o</b>. <br>
+The effect of this option is defined by the <b>zlib</b>(3)
+library used by <b>OptiPNG</b>.</p>
+
+<p style="margin-left:11%;"><b>&minus;zw</b>
+<i>size</i></p>
+
+<p style="margin-left:22%;">Select the zlib window size
+(32k,16k,8k,4k,2k,1k,512,256) used in IDAT compression. <br>
+The <i>size</i> argument can be specified either in bytes
+(e.g. 16384) or kilobytes (e.g. 16k). The default
+<i>size</i> value is set to the lowest window size that
+yields an IDAT output as big as if yielded by the value
+32768. <br>
+The effect of this option is defined by the <b>zlib</b>(3)
+library used by <b>OptiPNG</b>.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Editing
+options</b></p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="7%">
+
+
+<p><b>&minus;snip</b></p></td>
+<td width="4%"></td>
+<td width="78%">
+
+
+<p>Cut one image out of multi-image, animation or video
+files.</p> </td></tr>
+</table>
+
+<p style="margin-left:22%;">Depending on the input format,
+this may be either the first or the most relevant (e.g. the
+largest) image.</p>
+
+<p style="margin-left:11%;"><b>&minus;strip</b>
+<i>objects</i></p>
+
+<p style="margin-left:22%;">Strip metadata objects from a
+PNG file. <br>
+PNG metadata is the information stored in any ancillary
+chunk except <tt>tRNS</tt>. (<tt>tRNS</tt> represents the
+alpha channel, which, even if ignored in rendering, is still
+a proper image channel in the RGBA color space.) <br>
+The only option currently supported is <b>&minus;strip
+all</b>.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Notes</b>
+<br>
+Options may come in any order (except for
+<b>&minus;&minus;</b>), before, after, or alternating with
+file names. Option names are case-insensitive and may be
+abbreviated to their shortest unique prefix.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Some options
+may have arguments that follow the option name, separated by
+whitespace or the equal sign (&rsquo;<b>=</b>&rsquo;). If
+the option argument is a number or a rangeset, the separator
+may be omitted. For example:</p>
+
+
+<p style="margin-left:22%; margin-top: 1em"><b>&minus;out</b>
+<tt>newfile.png &nbsp;</tt>&lt;=&gt;
+&nbsp;<b>&minus;out=</b><tt>newfile.png</tt> <b><br>
+&minus;o3 &nbsp;</b>&lt;=&gt; &nbsp;<b>&minus;o 3
+&nbsp;</b>&lt;=&gt; &nbsp;<b>&minus;o=3 <br>
+&minus;f0,3&minus;5 &nbsp;</b>&lt;=&gt; &nbsp;<b>&minus;f
+0,3&minus;5 &nbsp;</b>&lt;=&gt;
+&nbsp;<b>&minus;f=0,3&minus;5</b></p>
+
+<p style="margin-left:11%; margin-top: 1em">Rangeset
+arguments are cumulative; e.g.</p>
+
+<p style="margin-left:22%; margin-top: 1em"><b>&minus;f0
+&minus;f3&minus;5 &nbsp;</b>&lt;=&gt;
+&nbsp;<b>&minus;f0,3&minus;5 <br>
+&minus;zs0 &minus;zs1 &minus;zs2&minus;3 &nbsp;</b>&lt;=&gt;
+&nbsp;<b>&minus;zs0,1,2,3 &nbsp;</b>&lt;=&gt;
+&nbsp;<b>&minus;zs0&minus;3</b></p>
+
+<h2>EXTENDED DESCRIPTION
+<a name="EXTENDED DESCRIPTION"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">The PNG
+optimization algorithm consists of the following steps:</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p>1.</p></td>
+<td width="3%"></td>
+<td width="83%">
+
+
+<p>Reduce the bit depth, the color type and the color
+palette of the image. This step may reduce the size of the
+uncompressed image, which, indirectly, may reduce the size
+of the compressed image (i.e. the size of the output PNG
+file).</p> </td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p>2.</p></td>
+<td width="3%"></td>
+<td width="83%">
+
+
+<p>Run a suite of compression methods and strategies and
+select the compression parameters that yield the smallest
+output file.</p></td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p>3.</p></td>
+<td width="3%"></td>
+<td width="83%">
+
+
+<p>Store all IDAT contents into a single chunk, eliminating
+the overhead incurred by repeated IDAT headers and CRCs.</p></td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="3%">
+
+
+<p>4.</p></td>
+<td width="3%"></td>
+<td width="83%">
+
+
+<p>Set the zlib window size inside IDAT to a mininum that
+does not affect the compression ratio, reducing the memory
+requirements of PNG decoders.</p></td></tr>
+</table>
+
+<p style="margin-left:11%; margin-top: 1em">Not all of the
+above steps need to be executed. The behavior depends on the
+actual input files and user options.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Step 1 may be
+customized via the no-reduce options <b>&minus;nb</b>,
+<b>&minus;nc</b>, <b>&minus;np</b> and <b>&minus;nx</b>.
+Step 2 may be customized via the <b>&minus;o</b> option, and
+may be fine-tuned via the options <b>&minus;zc</b>,
+<b>&minus;zm</b>, <b>&minus;zs</b> and <b>&minus;zw</b>.
+Step 3 is always executed. Step 4 is executed only if a new
+IDAT is being created, and may be fine-tuned via the option
+<b>&minus;zw</b>.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Extremely
+exhaustive searches are not generally expected to yield
+significant improvements in compression ratio, and are
+recommended to advanced users only.</p>
+
+<h2>EXAMPLES
+<a name="EXAMPLES"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><tt>optipng
+file.png &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt># default speed
+<tt><br>
+optipng -o5 file.png &nbsp;</tt># slow <tt><br>
+optipng -o7 file.png &nbsp;</tt># very slow</p>
+
+<h2>BUGS
+<a name="BUGS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Lossless image
+reductions are not completely implemented. (This does
+<i>not</i> affect the integrity of the output files.) Here
+are the missing pieces:</p>
+
+<p style="margin-left:22%; margin-top: 1em">&minus; The
+color palette reductions are implemented only partially.
+<br>
+&minus; The bit depth reductions below 8, for grayscale
+images, are not implemented yet.</p>
+
+<p style="margin-left:11%; margin-top: 1em">TIFF support is
+limited to uncompressed, PNG-compatible (grayscale, RGB and
+RGBA) images.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Metadata is not
+imported from the external image formats.</p>
+
+<p style="margin-left:11%; margin-top: 1em">There is no
+support for pipes or streams.</p>
+
+<h2>SEE ALSO
+<a name="SEE ALSO"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>png</b>(5),
+<b>libpng</b>(3), <b>zlib</b>(3), <b>pngcrush</b>(1),
+<b>pngrewrite</b>(1).</p>
+
+<h2>STANDARDS
+<a name="STANDARDS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">The files
+produced by <b>OptiPNG</b> are compliant with
+<b>PNG&minus;2003</b>: <br>
+Glenn Randers-Pehrson et al. <i>Portable Network Graphics
+(PNG) Specification, Second Edition</i>. <br>
+W3C Recommendation 10 November 2003; ISO/IEC IS 15948:2003
+(E). <tt><br>
+http://www.w3.org/TR/PNG/</tt></p>
+
+<h2>AUTHOR
+<a name="AUTHOR"></a>
+</h2>
+
+
+
+<p style="margin-left:11%; margin-top: 1em"><tt><b>OptiPNG</b></tt>
+is written and maintained by Cosmin Truta.</p>
+
+<p style="margin-left:11%; margin-top: 1em">This manual
+page was originally written by Nelson A. de Oliveira for the
+Debian Project. It was later updated by Cosmin Truta, and is
+now part of the <b>OptiPNG</b> distribution.</p>
+<hr>
+</body>
+</html>
View
BIN  vendor/optipng-0.7.1-win32/doc/optipng.man.pdf
Binary file not shown
View
296 vendor/optipng-0.7.1-win32/doc/optipng.man.txt
@@ -0,0 +1,296 @@
+OPTIPNG(1) OPTIPNG(1)
+
+NAME
+ OptiPNG - Optimize Portable Network Graphics files
+
+SYNOPSIS
+ optipng [-? | -h | -help]
+ optipng [options...] files...
+
+DESCRIPTION
+ The OptiPNG program shall attempt to optimize PNG files, i.e. reduce
+ their size to a minimum, without losing semantic information. In addi-
+ tion, this program shall perform a suite of auxiliary functions like
+ integrity checks, metadata recovery and pixmap-to-PNG conversion.
+
+ The optimization attempts are not guaranteed to succeed. Valid PNG
+ files that cannot be optimized by this program are normally left
+ intact; their size will not grow. The user may request to override this
+ default behavior.
+
+FILES
+ The input files are raster image files encoded either in PNG format
+ (the native format), or in an external format. The currently supported
+ external formats are GIF, BMP, PNM and TIFF.
+
+ OptiPNG processes each image file given in the command line as follows:
+
+ - If the image is in PNG format:
+
+ Attempts to optimize the given file in-place. If optimization is
+ successful, or if the option -force is enabled, replaces the
+ original file with its optimized version. The original file is
+ backed up if the option -keep is enabled.
+
+ - If the image is in an external format:
+
+ Creates an optimized PNG version of the given file. The output
+ file name is composed from the original file name and the .png
+ extension.
+
+ Existing files are not overwritten, unless the option -clobber is
+ enabled.
+
+OPTIONS
+ General options
+ -?, -h, -help
+ Show a complete summary of options.
+
+ -backup, -keep
+ Keep a backup of the modified files.
+
+ -clobber
+ Overwrite the existing output and backup files.
+ Under this option, if the option -backup is not enabled, the old
+ backups of the overwritten files are deleted.
+
+ -dir directory
+ Write the output files to directory.
+
+ -fix Enable error recovery. This option has no effect on valid input
+ files.
+ The program will spend a reasonable amount of effort to recover
+ as much data as possible, without increasing the output file
+ size, but the success cannot be generally guaranteed. The pro-
+ gram may even increase the file size, e.g., by reconstructing
+ missing critical data. Under this option, integrity shall take
+ precedence over file size.
+ When this option is not used, the invalid input files are left
+ unprocessed.
+
+ -force Enforce writing of a new output file.
+ This option overrides the program's decision not to write such
+ file, e.g. when the PNG input is digitally signed (using dSIG),
+ or when the PNG output becomes larger than the PNG input.
+
+ -log file
+ Log messages to file. For safety reasons, file must have the
+ extension .log.
+ This option is deprecated and will be removed eventually. Use
+ shell redirection.
+
+ -out file
+ Write output file to file. The command line must contain
+ exactly one input file.
+
+ -preserve
+ Preserve file attributes (time stamps, file access rights, etc.)
+ where applicable.
+
+ -quiet, -silent
+ Run in quiet mode.
+ The messages are still written to the log file if the option
+ -log is enabled.
+
+ -simulate
+ Run in simulation mode: perform the trials, but do not create
+ output files.
+
+ -v Enable the options -verbose and -version.
+
+ -verbose
+ Run in verbose mode.
+
+ -version
+ Show copyright, version and build info.
+
+ -- Stop option switch parsing.
+
+ PNG encoding and optimization options
+ -o level
+ Select the optimization level.
+ The optimization level 0 enables a set of optimization opera-
+ tions that require minimal effort. There will be no changes to
+ image attributes like bit depth or color type, and no recompres-
+ sion of existing IDAT datastreams.
+ The optimization level 1 enables a single IDAT compression
+ trial. The trial chosen is what OptiPNG thinks it's probably the
+ most effective.
+ The optimization levels 2 and higher enable multiple IDAT com-
+ pression trials; the higher the level, the more trials.
+ The behavior and the default value of this option may change
+ across different program versions. Use the option -h to see the
+ details pertaining to your specific version.
+
+ -f filters
+ Select the PNG delta filters.
+ The filters argument is specified as a rangeset (e.g. -f0-5),
+ and the default filters value depends on the optimization level
+ set by the option -o.
+ The filter values 0, 1, 2, 3 and 4 indicate static filtering,
+ and correspond to the standard PNG filter codes (None, Left, Up,
+ Average and Paeth, respectively). The filter value 5 indicates
+ adaptive filtering, whose effect is defined by the libpng(3)
+ library used by OptiPNG.
+
+ -full Produce a full report on IDAT. This option might slow down the
+ trials.
+
+ -i type
+ Select the interlace type (0-1).
+ If the interlace type 0 is selected, the output image shall be
+ non-interlaced (i.e. progressive-scanned). If the interlace type
+ 1 is selected, the output image shall be interlaced using the
+ Adam7 method.
+ By default, the output shall have the same interlace type as the
+ input.
+
+ -nb Do not apply bit depth reduction.
+
+ -nc Do not apply color type reduction.
+
+ -np Do not apply palette reduction.
+
+ -nx Do not apply any lossless image reduction: enable the options
+ -nb, -nc and -np.
+
+ -nz Do not recode IDAT datastreams.
+ The IDAT optimization operations that do not require recoding
+ (e.g. IDAT chunk concatenation) are still performed.
+ This option has effect on PNG input files only.
+
+ -zc levels
+ Select the zlib compression levels used in IDAT compression.
+ The levels argument is specified as a rangeset (e.g. -zc6-9),
+ and the default levels value depends on the optimization level
+ set by the option -o.
+ The effect of this option is defined by the zlib(3) library used
+ by OptiPNG.
+
+ -zm levels
+ Select the zlib memory levels used in IDAT compression.
+ The levels argument is specified as a rangeset (e.g. -zm8-9),
+ and the default levels value depends on the optimization level
+ set by the option -o.
+ The effect of this option is defined by the zlib(3) library used
+ by OptiPNG.
+
+ -zs strategies
+ Select the zlib compression strategies used in IDAT compression.
+ The strategies argument is specified as a rangeset (e.g.
+ -zs0-3), and the default strategies value depends on the opti-
+ mization level set by the option -o.
+ The effect of this option is defined by the zlib(3) library used
+ by OptiPNG.
+
+ -zw size
+ Select the zlib window size (32k,16k,8k,4k,2k,1k,512,256) used
+ in IDAT compression.
+ The size argument can be specified either in bytes (e.g. 16384)
+ or kilobytes (e.g. 16k). The default size value is set to the
+ lowest window size that yields an IDAT output as big as if
+ yielded by the value 32768.
+ The effect of this option is defined by the zlib(3) library used
+ by OptiPNG.
+
+ Editing options
+ -snip Cut one image out of multi-image, animation or video files.
+ Depending on the input format, this may be either the first or
+ the most relevant (e.g. the largest) image.
+
+ -strip objects
+ Strip metadata objects from a PNG file.
+ PNG metadata is the information stored in any ancillary chunk
+ except tRNS. (tRNS represents the alpha channel, which, even if
+ ignored in rendering, is still a proper image channel in the
+ RGBA color space.)
+ The only option currently supported is -strip all.
+
+ Notes
+ Options may come in any order (except for --), before, after, or alter-
+ nating with file names. Option names are case-insensitive and may be
+ abbreviated to their shortest unique prefix.
+
+ Some options may have arguments that follow the option name, separated
+ by whitespace or the equal sign ('='). If the option argument is a num-
+ ber or a rangeset, the separator may be omitted. For example:
+
+ -out newfile.png <=> -out=newfile.png
+ -o3 <=> -o 3 <=> -o=3
+ -f0,3-5 <=> -f 0,3-5 <=> -f=0,3-5
+
+ Rangeset arguments are cumulative; e.g.
+
+ -f0 -f3-5 <=> -f0,3-5
+ -zs0 -zs1 -zs2-3 <=> -zs0,1,2,3 <=> -zs0-3
+
+EXTENDED DESCRIPTION
+ The PNG optimization algorithm consists of the following steps:
+
+ 1. Reduce the bit depth, the color type and the color palette of the
+ image. This step may reduce the size of the uncompressed image,
+ which, indirectly, may reduce the size of the compressed image
+ (i.e. the size of the output PNG file).
+
+ 2. Run a suite of compression methods and strategies and select the
+ compression parameters that yield the smallest output file.
+
+ 3. Store all IDAT contents into a single chunk, eliminating the over-
+ head incurred by repeated IDAT headers and CRCs.
+
+ 4. Set the zlib window size inside IDAT to a mininum that does not
+ affect the compression ratio, reducing the memory requirements of
+ PNG decoders.
+
+ Not all of the above steps need to be executed. The behavior depends on
+ the actual input files and user options.
+
+ Step 1 may be customized via the no-reduce options -nb, -nc, -np and
+ -nx. Step 2 may be customized via the -o option, and may be fine-tuned
+ via the options -zc, -zm, -zs and -zw. Step 3 is always executed. Step
+ 4 is executed only if a new IDAT is being created, and may be fine-
+ tuned via the option -zw.
+
+ Extremely exhaustive searches are not generally expected to yield sig-
+ nificant improvements in compression ratio, and are recommended to
+ advanced users only.
+
+EXAMPLES
+ optipng file.png # default speed
+ optipng -o5 file.png # slow
+ optipng -o7 file.png # very slow
+
+BUGS
+ Lossless image reductions are not completely implemented. (This does
+ not affect the integrity of the output files.) Here are the missing
+ pieces:
+
+ - The color palette reductions are implemented only partially.
+ - The bit depth reductions below 8, for grayscale images, are
+ not implemented yet.
+
+ TIFF support is limited to uncompressed, PNG-compatible (grayscale, RGB
+ and RGBA) images.
+
+ Metadata is not imported from the external image formats.
+
+ There is no support for pipes or streams.
+
+SEE ALSO
+ png(5), libpng(3), zlib(3), pngcrush(1), pngrewrite(1).
+
+STANDARDS
+ The files produced by OptiPNG are compliant with PNG-2003:
+ Glenn Randers-Pehrson et al. Portable Network Graphics (PNG) Specifi-
+ cation, Second Edition.
+ W3C Recommendation 10 November 2003; ISO/IEC IS 15948:2003 (E).
+ http://www.w3.org/TR/PNG/
+
+AUTHOR
+ OptiPNG is written and maintained by Cosmin Truta.
+
+ This manual page was originally written by Nelson A. de Oliveira for
+ the Debian Project. It was later updated by Cosmin Truta, and is now
+ part of the OptiPNG distribution.
+
+OptiPNG version 0.7.1 2012-Mar-19 OPTIPNG(1)
View
634 vendor/optipng-0.7.1-win32/doc/png_optimization.html
@@ -0,0 +1,634 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta name="Author" content="Cosmin Truţa">
+ <title>A guide to PNG optimization</title>
+</head>
+<body>
+
+<h2>A guide to PNG optimization</h2>
+
+<h3>1. Background</h3>
+
+<h4>1.1 The PNG file format</h4>
+
+<p>
+The <a href="http://www.libpng.org/pub/png/">Portable Network Graphics</a>
+(<b><i>PNG</i></b>) is a format for storing compressed raster graphics. The
+compression engine is based on the <b><i>Deflate</i></b> method
+[<a href="http://www.ietf.org/rfc/rfc1951">RFC1951</a>],
+designed by
+<a href="http://www.pkware.com/">PKWare</a>
+and originally used in <b>PKZIP</b>.
+</p>
+
+<p>
+The PNG format is defined by the
+<a href="http://www.libpng.org/pub/png/spec/">PNG Specification</a>.
+This specification was developed by an ad-hoc group named the
+<a href="http://www.libpng.org/pub/png/">PNG Development Group</a>, and it is
+both an International Standard (published under the formal name
+ISO/IEC&nbsp;15948) and a W3C Recommendation.
+</p>
+
+<p>
+PNG was initially intended as a superior, patent-free replacement of GIF. The
+final outcome is a modern, extensible, reliable image format, capable to handle
+an impressive number of image types (from 1-bit black-and-white images up to
+48-bit RGB images with a full 16-bit alpha channel), and geared by a
+significantly stronger lossless compression engine (typically 5-25% better than
+GIF).
+</p>
+
+<p>
+Unlike other lossless compression schemes, PNG compression does not depend
+solely on the statistics of the input, but it may vary within wide limits,
+depending on the compressor's implementation. A good PNG encoder must be
+able to take informed decisions about the factors that affect the size of the
+output. The purpose of this article is to provide information about these
+factors, and to give advice on implementing efficient PNG encoders.
+</p>
+
+
+<h4>1.2 The PNG compression</h4>
+
+<p>
+The PNG compression works in a pipeline manner.
+</p>
+
+<p>
+In the first stage, the image pixels are passed through a lossless arithmetic
+transformation named <b><i>delta filtering</i></b>, or simply
+<b><i>filtering</i></b>, and sent further as a (filtered) byte sequence.
+Filtering does not compress or otherwise reduce the size of the data, but it
+makes the data more compressible.
+</p>
+
+<p>
+In the second stage, the filtered byte sequence is passed through the
+Ziv-Lempel algorithm (LZ77), producing LZ77 codes that are further compressed
+by the Huffman algorithm in the third and final stage. The combination of the
+last two stages is referred to as the <b><i>Deflate compression</i></b>, a
+widely-used, patent-free algorithm for universal, lossless data compression.
+The maximum size of the LZ77 sliding window in Deflate is 32768 bytes, and the
+LZ77 matches can be between 3 and 258 bytes long.
+</p>
+
+<p>
+A complete description of the PNG compression is beyond the scope of this
+guide. The PNG Specification describes the format completely, and provides
+a complete list of references to the underlying technologies.
+</p>
+
+
+<h3>2. Factors that affect the PNG file size</h3>
+
+<div>
+Like any other compression scheme, PNG compression depends on the statistics
+of the input data. In addition, it depends on the following PNG-specific
+parameters:
+</div>
+<ol>
+<li>
+ The PNG image type
+</li>
+<li>
+ The PNG delta filters
+</li>
+<li>
+ The strategy of searching LZ77 matches
+</li>
+<li>
+ The size of the Huffman buffers inside the Deflate encoder
+</li>
+</ol>
+
+<p>
+Depending on how these parameters are chosen by the implementation, PNG
+compression may vary within wide limits. The process of selecting the best
+configuration is computationally infeasible, but heuristics to select a
+satisfactory configuration are available. The problem of improving these
+heuristics constitutes an interesting subject for research.
+</p>
+
+
+<h4>2.1 The PNG image type</h4>
+
+<p>
+The type of a PNG image is defined in the <b><code>IHDR</code></b> image
+header. The image has a certain bit depth, up to 16 bits per sample, and a
+certain color type, from Grayscale to RGB+Alpha. If two PNG files of different
+types represent exactly the same image, each file can be regarded as a lossless
+transformation of the other. A lossless transformation can reduce the
+<i>uncompressed</i> stream, and such a transformation is named <b><i>image
+reduction</i></b>. In most cases, image reductions are capable of reducing the
+<i>compressed</i> stream (which is, in fact, our interest), as an indirect
+effect of reducing the size of the compressor's input.
+</p>
+
+<div>
+The possible image reductions are:
+</div>
+<ul>
+<li>
+ <i>Bit depth reduction</i>
+ <br>
+ The bit depth can be reduced to a minimum value that is acceptable for all
+ samples. For example, if all sample values in a 16-bit image have the form
+ (256+1)*<i>n</i>, (e.g. #0000, #2323, #FFFF), then the bit depth can be
+ reduced to 8, and the new sample values will become <i>n</i>, (e.g. #00, #23,
+ #FF).
+</li>
+<li>
+ <i>Color type reduction</i>
+ <br>
+ - If an RGB image has 256 distinct colors or less, it can be reencoded as a
+ Palette image.
+ <br>
+ - If an RGB or Palette image has only gray pixels, it can be reencoded as
+ Grayscale.
+ <br>
+ A color type reduction can also enable a bit depth reduction.
+</li>
+<li>
+ <i>Color palette reduction</i>
+ <br>
+ If the color palette contains redundant entries (i.e. duplicate entries that
+ indicate the same RGB value) or sterile entries (i.e. entries that do not
+ have a correspondent in the raw pixel data), these entries can be removed.
+ <br>
+ A color palette reduction can also enable a bit depth reduction.
+</li>
+<li>
+ <i>Alpha channel reduction</i>
+ <br>
+ If all pixels in a Grayscale+Alpha or an RGB+Alpha image are fully opaque
+ (i.e. all alpha components are equal to 2^<sup>bitdepth</sup>-1), or if the
+ transparency information can be stored entirely in a (much cheaper)
+ <b><code>tRNS</code></b> chunk, the alpha channel can be stripped.
+</li>
+</ul>
+
+<p>
+There are, however, a few cases when some image type reductions do not
+necessarily lead to the reduction of the compressed stream. The
+<a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a> site contains
+experimental analyses of these possibilities; for example, see the article
+<a href="8bpp.html">8 bits per pixel in paletted images</a>.
+</p>
+
+<p>
+Interlacing, useful for a faster, progressive rendering, is another component
+of the PNG image type that affects compression. In an interlaced stream, the
+samples corresponding to neighboring pixels are stored far away, hence the data
+in it is less correlated and less compressible. Unlike JPEG, where interlacing
+may improve the compression slightly, the PNG interlacing degrades the
+compression significantly.
+</p>
+
+
+<h4>2.2 The PNG delta filters</h4>
+
+<p>
+The role of filtering can be illustrated in the following example. Assume the
+sequence 2, 3, 4, 5, 6, 7, 8, 9. Although it has much redundancy, the sequence
+is not compressible by a Ziv-Lempel compressor, nor by a Huffman compressor.
+However, if one makes a simple and reversible transformation, replacing each
+value with the numerical difference between it and the value to its left, the
+sequence becomes 2, 1, 1, 1, 1, 1, 1, 1, which is highly compressible.
+</p>
+
+<p>
+The PNG format employs five types of filters: <b><i>None</i></b>,
+<b><i>Left</i></b>, <b><i>Up</i></b>, <b><i>Average</i></b>, and
+<b><i>Paeth</i></b>. The first filter leaves the original data intact, and the
+other four are subtracting from each pixel a value that involves the
+neighbor pixels from the left, up, and/or the upper left.
+</p>
+
+<p>
+A certain filter is assigned to each row, and is applied to all pixels from
+that row. Therefore, an image can be delta-filtered in a huge number of
+possible configurations (5 ^ <sup><i>height</i></sup>), and each configuration
+leads to a different compressed output. Two different filter configurations may
+make a difference in the compressed file size by a couple of factors, so a
+careful choice of filters is of paramount importance.
+</p>
+
+<p>
+It is possible to apply a single filter to all rows, or to apply different
+filters to different rows. In the former case, the filtering process is
+<b><i>fixed</i></b>; in the latter, it is <b><i>adaptive</i></b>.
+</p>
+
+<div>
+While an exhaustive search is unfeasible, the PNG Specification suggests a
+heuristic filtering strategy:
+</div>
+<ul>
+<li>
+ If the image type is Palette, or the bit depth is smaller than 8, then
+ do not filter the image (i.e. use fixed filtering, with the filter
+ <i>None</i>).
+</li>
+<li>
+ (The other case) If the image type is Grayscale or RGB (with or without
+ Alpha), and the bit depth is not smaller than 8, then use adaptive filtering
+ as follows: <i>independently for each row</i>, apply all five filters and
+ select the filter that produces the smallest sum of absolute values per row.
+</li>
+</ul>
+
+<p>
+Cases where the above heuristics are less than optimal are shown on the
+<a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a>
+site; for example, see
+<a href="better-filtering.html">Brute-force vs. heuristic filtering</a>.
+</p>
+
+
+<h4>2.3 The strategy of searching LZ77 matches</h4>
+
+<p>
+The Ziv-Lempel algorithm works under the assumption that contiguous sequences
+appear repeatedly in the input stream. If the sequence to be encoded matches
+one or more sequences already present in the sliding history window, the
+encoder sends a LZ77 pair (<i>distance</i>, <i>length</i>) that points to the
+<i>closest</i> match. In most LZ77 incarnations, including Deflate, smaller
+distance codes are encoded more concisely.
+</p>
+
+<p>
+In Deflate, in particular, the regular (non-matched) symbols, and the match
+lengths, are sent to the same Huffman coder, while the match distances are sent
+to a separate Huffman coder. If the LZ77 matches fall between the accepted
+boundaries (i.e. they are not shorter than 3 and not longer than 258), a greedy
+strategy will accept them as a replacement for the symbols to which they
+correspond.
+</p>
+
+<p>
+The greedy strategy is preferable when compressing text files, or many types of
+binary files, but it may be suboptimal when compressing filtered data, such as
+the byte strings that come from a PNG filter. Filtered data consist mostly of
+small values with a pseudo-random distribution. Therefore, in certain
+situations, it may be desirable to favor the encoding of individual symbols,
+even if matches that may replace these symbols exist.
+</p>
+
+<p>
+The
+<a href="http://www.zlib.org/">zlib Reference Library</a>
+is a reference implementation of Deflate, which is further used by the
+<a href="http://www.libpng.org/pub/png/libpng.html">PNG Reference Library</a>.
+By default, <b>zlib</b> selects the greedy strategy, but the user is able to
+specify his or her custom preference via the <code>strategy</code> parameter.
+This parameter can take one of the following values:
+<br>
+- <code>Z_DEFAULT_STRATEGY = 0</code>, the default greedy search strategy.
+<br>
+- <code>Z_FILTERED = 1</code>, a strategy in which the matches are accepted
+only if their length is 6 or bigger.
+<br>
+- <code>Z_HUFFMAN_ONLY = 2</code>, a fast strategy in which the Ziv-Lempel
+algorithm is entirely bypassed, and all the symbols from the input are encoded
+directly by the Huffman coder.
+<br>
+- <code>Z_RLE = 3</code> (appeared in the <b>zlib-1.2.x</b> series), a fast
+strategy in which the LZ77 algorithm is essentially reduced to the Run-Length
+Encoding algorithm. In other words, the matches are accepted only if their
+distance is 1. For example, the 10-symbol sequence "<code>aaaaaaaaaa</code>"
+can be LZ77-encoded as
+['<code>a</code>', (<i>distance</i>=1, <i>length</i>=9)];
+by removing <i>distance</i>=1 from the picture, this encoding can be regarded
+as a peculiar run-length encoding (which differs from the classic RLE by using
+<i>length</i>=9 instead of <i>count</i>=10).
+<br>
+The <code>strategy</code> parameter affects only the compression ratio. It does
+not affect the correctness of the compressed output, even if it is set to an
+inappropriate value.
+</p>
+
+<p>
+It was experimentally observed that the LZ77 search is occasionally capable of
+producing smaller PNGs if it is less exhaustive. The reason behind this act
+resides in the same category of "strategic searches" discussed here.
+Unfortunately, there is no known method of anticipating which search level
+(from the fastest and the least exhaustive, to the slowest and the most
+exhaustive) is better, other than assuming "the most exhaustive is better in
+most cases".
+</p>
+
+<p>
+Unfortunately, even a "filtered" strategy does not always produce better
+results than a "greedy" strategy on filtered input, and the only known method
+to obtain the best combination is by multiple trials. Experiments and
+measurements can, again, be found on the
+<a href="http://www.cs.toronto.edu/~cosmin/pngtech/">PNG-Tech</a>
+site; for example, see the original
+<a href="z_rle.html">Z_RLE strategy proposal</a>.
+</p>
+
+
+<h4>2.4 The size of Huffman buffers</h4>
+
+<p>
+As mentioned earlier, the entropy encoder inside the Deflate method is the
+static Huffman algorithm. The output of LZ77 is fed into a buffer which is
+occasionally flushed by sending a static Huffman tree followed by all the
+Huffman codes, to the output of Deflate. After this, both the buffer and the
+Huffman tree are reset, waiting for the subsequent LZ77 codes to come and
+refill the buffer.
+</p>
+
+<blockquote>
+The Deflate specification refers to <i>dynamic Huffman codes</i>. However, this
+is a misnomer, in which the term <i>dynamic</i> is used in contrast to the
+<i>fixed</i> Huffman codes. The fixed Huffman codes are simply built according
+to a predefined Huffman tree, without regard to the actual symbol frequencies.
+The dynamic Huffman codes referred to by the Deflate specification are NOT
+built by the dynamic Huffman algorithm, as defined, for example, by Faller,
+Gallager and Knuth (the FGK algorithm), or by Vitter (the V algorithm).
+The predefined Huffman tree was introduced in <b>PKZIP</b> as a fast
+compression alternative, but it produces poor results even on text, and it is
+almost useless in PNG compression. Still, a PNG stream that contains codes
+built by the fixed (predefined) Huffman tree, is a valid stream, and a
+compliant PNG reader must decode this stream correctly.
+</blockquote>
+
+<p>
+It is desirable to establish the buffer boundaries so that sequences conforming
+to the same probability model are fit in the same Huffman buffer. Methods for
+approaching these boundaries exist, but they are not used in the mainstream
+Deflate implementation(s). Instead, the buffers are flushed when a limit
+(typically, 16k LZ77 codes) is reached. This is, however, a fast approach, and
+the results are satisfactory.
+</p>
+
+<p>
+The size of Huffman buffers is indirectly determined by the encoder's memory
+(usage) level. For this reason, certain memory levels might be good for certain
+types of images.
+</p>
+
+
+<h3>3. PNG (lossless) optimization programs</h3>
+
+<p>
+The multitude of PNG encoding programs is listed at
+<a href="http://www.libpng.org/pub/png/pngapps.html">http://www.libpng.org/pub/png/pngapps.html</a>.
+Their performance varies as much as the range of possible compression ratios;
+the good encoders are at least applying the filtering heuristics, described
+briefly in the PNG Specification, and illustrated above.
+<br>
+Some programs gain extra compression by discarding some of the data in the
+input images (so these programs are <i>lossy</i>!)
+</p>
+
+<p>
+This section contains the small list of <b><i>PNG optimization programs</i></b>
+that show a particular concern towards obtaining a file size as small as
+possible. They work by performing repeated compression trials, applying various
+parameter sets, and selecting the parameter set that yields the smallest
+compressed output.
+</p>
+
+<ul>
+<li>
+ <p>
+ <b>pngrewrite</b> by Jason Summers, available at
+ <a href="http://www.pobox.com/~jason1/pngrewrite/">http://www.pobox.com/~jason1/pngrewrite</a>,
+ is an open-source program that performs lossless image reductions.
+ It works best in conjunction with <b>pngcrush</b> (see below); the user
+ should run <b>pngcrush</b> <i>after</i> <b>pngrewrite</b>.
+ </p>
+</li>
+<li>
+ <p>
+ <b>pngcrush</b> by Glenn Randers-Pehrson, available at
+ <a href="http://pmt.sourceforge.net/pngcrush/">http://pmt.sourceforge.net/pngcrush</a>,
+ is an open-source program that iterates over PNG filters and zlib (Deflate)
+ parameters, compresses the image repeatedly using each parameter
+ configuration, and chooses the configuration that yields the smallest
+ compressed (IDAT) output.
+ At the user's option, the program can explore few (below 10) or many (a
+ brute-force traversal over more than 100) configurations. The method of
+ selecting the parameters for "few" trials is particularly effective, and the
+ use of a brute-force traversal is generally not recommended.
+ </p>
+ <p>
+ In addition, <b>pngcrush</b> offers a multitude of extra features, such as
+ recovery of erroneous PNG files (e.g. files containing bad CRCs), and
+ chunk-level editing of PNG meta-data.
+ </p>
+</li>
+<li>
+ <p>
+ <b>OptiPNG</b> by Cosmin Truţa, available at
+ <a href="http://www.cs.toronto.edu/~cosmin/pngtech/optipng/">http://www.cs.toronto.edu/pngtech/optipng</a>,
+ is a newer open-source program, inspired from <b>pngcrush</b>, but designed
+ to be more flexible and to run faster.
+ Unlike <b>pngcrush</b>, <b>OptiPNG</b> performs the trials entirely in
+ memory, and writes only the final output file on the disk. Moreover, it
+ offers multiple optimization presets to the user, who can choose among a
+ range of options from "very few trials" to "very many trials" (in contrast to
+ the coarser "smart vs. brute" option offered by <b>pngcrush</b>).
+ </p>
+ <p>
+ It is important to mention that the achieved compression ratio is less and
+ less likely to improve when higher-level presets (trigerring more trials)
+ are being used. Even if the program is capable of searching automatically
+ over more than 200 configurations (and the advanced users have access to more
+ than 1000 configurations!), a preset that selects around 10 trials should be
+ satisfactory for most users. Furthermore, a preset that selects between
+ 30-40 trials <i>should</i> be satisfactory for all users, for it is very,
+ very unlikely to be beaten significantly by any wider search. The rest of the
+ trial configurations are offered rather as a curiosity (but they were used in
+ the experimentation from which we concluded they are indeed useless!)
+ </p>
+</li>
+<li>
+ <p>
+ <b>AdvanceCOMP</b> by Andrea Mazzoleni is a set of tools for optimizing
+ ZIP/GZIP, PNG and MNG files, based on the powerful <b>7-Zip</b> deflation
+ engine. The name of the PNG optimization tool is <b>AdvPNG</b>. At the time
+ of this writing, <b>AdvPNG</b> does not perform image reductions, so the use
+ of <b>pngrewrite</b> or <b>OptiPNG</b> prior to optimiziation may be
+ necessary. However, given the effectivenes of <b>7-Zip</b> deflation,
+ <b>AdvanceCOMP</b> is a powerful contender.
+ </p>
+ <p>
+ The <b>AdvanceCOMP</b> tool set is a part of the <b>AdvanceMAME</b> project,
+ available at
+ <a href="http://advancemame.sourceforge.net/">http://advancemame.sourceforge.net</a>.
+ </p>
+</li>
+<li>
+ <p>
+ <b>PNGOut</b> by Ken Silverman, available at
+ <a href="http://advsys.net/ken/utils.htm">http://advsys.net/ken/utils.htm</a>,
+ is a freely-available compiled program (no source code), running on
+ Windows and Linux. According to our tests, the compression ratio achieved by
+ <b>PNGOut</b> is comparable to that of <b>AdvPNG</b>.
+ Unfortunately, due to the lack of information, we cannot say much about this
+ tool.
+ </p>
+ <p>
+ A nice GUI frontend for <b>PNGOut</b>, named <b>PNGGauntlet</b>, is
+ available at
+ <a href="http://www.numbera.com/software/pnggauntlet.aspx">http://www.numbera.com/software/pnggauntlet.aspx</a>.
+ </p>
+</li>
+</ul>
+
+
+<h3>4. An extra note on losslessness</h3>
+
+<p>
+What is lossless PNG optimization, after all? This is a straightforward
+question, whose answer is intuitive, yet not so straightforward.
+</p>
+
+<p>
+Losslessness in the strictest sense, where no information whatsoever is lost,
+can only be achieved by leaving the original file (<i>any</i> file) intact, or
+by transforming it (e.g. compressing it, encrypting it) in such a way that
+there is an inverse transformation which recovers it completely, bit by bit.
+</p>
+
+<p>
+In the case of PNG images, this condition of strict losslessness has little
+relevance to the casual graphics user, and is, therefore, too strong.
+There are instances where strict losslessness is required; for example, when
+handling certified PNG files whose integrity is guaranteed by an external
+checksum like <b>MD5</b> or <b>SHA</b>, or by a digital signature such as
+<b><code>dSIG</code></b>. Most of the time, however, it is desirable to relax
+the notion of PNG losslessness, to the extent of not losing any information
+that pertains to the <i>rendered image</i> and to the
+<i>semantic value of the metadata</i> that accompanies the image. This allows
+the user to concentrate on what is really important when it comes to preserving
+the contents of a PNG image, and enables the concept of PNG optimization tools.
+</p>
+
+<blockquote>
+A <b><i>lossless transform</i></b> of a PNG image file is a transform which
+fully preserves the <i>rendered</i> RGB triples (the RGB triples that come
+either directly, or from a palette index, or from a gray->RGB expansion), the
+<i>rendered</i> transparency (the alpha samples that come either directly, or
+from a <b><code>tRNS</code></b> chunk, or the implicit 100% opacity assumed due
+to the lack of any explicit transparency information), the <i>order of
+rendering</i> (sequential or interlaced), and the semantics contained by the
+ancillary chunks.
+</blockquote>
+
+<div>
+This definition allows the execution of the above-mentioned image reduction
+operations, and the recompression of <b><code>IDAT</code></b>. It also allows
+the alteration or the elimination of other pieces of information that are
+technically valid, but have no influence on any presentation of the image
+pixels:
+</div>
+<ul>
+<li>
+ The information that pertains to <b><i>Deflate</i></b> streams, either inside
+ <b><code>IDAT</code></b>, or in other compressed chunks like
+ <b><code>zTXt</code></b>, <b><code>iTXt</code></b> or
+ <b><code>iCCP</code></b>; e.g. the LZ77 window size, the type and size of
+ <b><i>Deflate</i></b> blocks, etc. (The only thing that matters is that the
+ decompressed byte sequence must remain the same.)
+</li>
+<li>
+ The order of palette entries inside a <b><code>PLTE</code></b> chunk. (When
+ changing this order, the information that depends on it, such as the
+ palette-encoded pixels or the <b><code>tRNS</code></b> information, must be
+ updated accordingly.)
+</li>
+<li>
+ RGB triples that do not correspond to any pixel in the actual image, but are
+ stored in a <b><code>tRNS</code></b> chunk.
+</li>
+<li>
+ Fully opaque <b><code>tRNS</code></b> entries in a palette image.
+</li>
+<li>
+ Gamma correction (<b><code>gAMA</code></b>) or significant bit
+ (<b><code>sBIT</code></b>) information inside an image that consists
+ exclusively of samples whose intensity is either minimum (0) or maximum
+ (2^<sup>bitdepth</sup>-1).
+</li>
+<li>
+ The fact that a textual comment is stored uncompressed in a
+ <b><code>tEXt</code></b> chunk, or compressed in a <b><code>zTXt</code></b>
+ chunk, or with no translation in an <b><code>iTXt</code></b> chunk.
+</li>
+<li>
+ Etcetera.
+</li>
+</ul>
+
+<p>
+If any of the discardable information is important in a particular application,
+and lossless PNG optimization is still desirable, it is recommended to store
+this information in ancillary chunks, rather than hack it inside critical
+chunks. For example, if sterile palette entries are necessary (e.g. for later
+editing stages), it is recommended to store them inside a suggested palette
+(<b><code>sPLT</code></b>) chunk, rather than keeping them inside
+<b><code>PLTE</code></b>.
+</p>
+
+
+<h3>5. Selective bibliography</h3>
+
+<p>
+Besides the discussed specifications, the references below provide essential
+information necessary to comprehend the contents of this article.
+</p>
+
+<ul>
+<li>
+ Thomas Boutell, Glenn Randers-Pehrson et al.
+ <i>Portable Network Graphics (PNG) Specification, Second Edition</i>.
+ ISO/IEC 15948:2003(E); W3C Recommendation 10 November 2003.
+</li>
+<li>
+ David A. Huffman.
+ A method for the construction of minimum redundancy codes.
+ In <i>Proceedings of the Institute of Radio Engineers</i>,
+ vol. 40, no. 9, pp. 1098-1101, September 1952.
+</li>
+<li>
+ Jacob Ziv and Abraham Lempel.
+ A universal algorithm for data compression.
+ <i>IEEE Transactions on Information Theory</i>,
+ vol. IT-23, no. 3, pp. 337-343, May 1977.
+ <br>
+ <font size="-1">
+ Due to a historical accident, the famous algorithm is better-known as the
+ "Lempel-Ziv (LZ) algorithm", even though the "Ziv-Lempel algorithm" is a
+ more legitimate name.
+ </font>
+</li>
+<li>
+ Greg Roelofs.
+ <i>PNG: The definitive guide</i>.
+ O'Reilly and Associates, 1999.
+</li>
+</ul>
+
+
+<hr>
+
+<address>
+<font size="-1">
+Copyright &copy; 2003-2008 Cosmin Truţa. Permission to distribute freely.
+<br>
+Appeared: 7&nbsp;Apr&nbsp;2003.
+<br>
+Last updated: 10&nbsp;May&nbsp;2008.
+</font>
+</address>
+
+</body>
+</html>
View
45 vendor/optipng-0.7.1-win32/doc/todo.txt
@@ -0,0 +1,45 @@
+
+OptiPNG - TO-DO list
+====================
+
+- Compression improvements:
+ Use zlib's deflateTune().
+ Use 7zip's powerful deflation engine.
+ (This is not possible with libpng, so a custom encoder is needed.)
+
+- Speed improvements:
+ Avoid repeated filtering when trying a filter value more than once.
+ (This is not possible with libpng, so a custom encoder is needed.)
+
+- Text chunk optimization:
+ Smart selection between tEXt and zTXt. Similarly for iTXt.
+
+- More file recovery features.
+
+- Input from stdin; output to stdout.
+
+- Optimization of an entire directory, with and without subdirectory
+ recursion:
+ optipng dir/
+ optipng -recurse dir/
+
+- Improved support for reading external image formats
+ (e.g. compressed TIFF).
+
+- Support for conversion to a desired bit depth and color type:
+ optipng -b16 -c6 ...
+
+- Support for handling metadata, e.g.:
+ optipng -set tEXt=<keyword>,<text> # add or update chunk
+ optipng -set sRGB=0 # add or update chunk
+ optipng -set image.precision=<n> # set the precision of all samples
+ optipng -set image.alpha.precision=<n> # set the precision of alpha samples
+ optipng -reset image.alpha # make the image fully opaque
+ optipng -strip hIST,sPLT # strip hIST and sPLT
+ optipng -strip all -protect iCCP # strip all metadata except iCCP
+
+- Parallelization on multi-processor/multi-core machines.
+
+- A shared library (e.g. optipng.dll), to facilitate the development of
+ PNG-optimizing GUI applications and plugins.
+
View
BIN  vendor/optipng-0.7.1-win32/optipng.exe
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.