Commit 4baac632 authored by Emmanuel Bouthenot's avatar Emmanuel Bouthenot

Imported Upstream version 0.6.4

parents
Copyright (C) 2001-2010 Cosmin Truta.
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.
CC = @CC@
all:
cd src; \
${MAKE} -f @MAKEFILE@ CC="${CC}"; \
cd ..
install:
cd src; \
${MAKE} -f @MAKEFILE@ install CC="${CC}"; \
cd ..
uninstall:
cd src; \
${MAKE} -f @MAKEFILE@ uninstall CC="${CC}"; \
cd ..
clean:
cd src; \
${MAKE} -f @MAKEFILE@ clean CC="${CC}"; \
cd ..
OptiPNG 0.6.4: Advanced PNG optimizer.
Copyright (C) 2001-2010 Cosmin Truta.
======================================
Goals
-----
Provide a powerful PNG converter/optimizer.
Demonstrate how to implement an efficient PNG encoder.
License
-------
Open-Source (zlib/libpng license).
Please see the attached LICENSE.
URI
---
Home page:
http://optipng.sourceforge.net/
Download:
http://sourceforge.net/project/showfiles.php?group_id=151404
Support:
http://sourceforge.net/tracker/?group_id=151404
Build instructions
------------------
Extract the source archive:
e.g. "tar -xzf optipng-0.6.4.tar.gz" or "unzip optipng-0.6.4.zip"
Go to the source directory:
"cd optipng-0.6.4/src/"
Run the appropriate makefile from the scripts directory:
e.g. "make -f scripts/gcc.mak" or "nmake -f scripts/visualc.mak"
OR
If you are using Microsoft Visual C++ 6.0 or later,
load and build the project "prj/visualc6/optipng.dsw"
Installation instructions
-------------------------
Follow the build instructions above.
On Unix:
Make the "install" target, using the same makefile
that was used for building the program:
e.g. "make -f scripts/gcc.mak install"
To uninstall, make the "uninstall" target:
e.g. "make -f scripts/gcc.mak uninstall"
On Windows:
Copy "optipng.exe" to a directory found in PATH.
Support
-------
Visit the SourceForge.net tracker:
http://sourceforge.net/tracker/?group_id=151404
OR
Send email to ctruta (at) gmail (dot) com
#!/bin/sh
# This a hand-crafted, experimental, and, well, uncommented configure script.
# Your feedback will be appreciated.
trap "rm -f conftest* core a.out; exit 1" 1 2 3 15
prefix=${prefix-/usr/local}
exec_prefix=${exec_prefix-'${prefix}'}
gcc=0
with_system_zlib=0
with_system_libpng=0
for option in "$@"
do
case $option in
*=* )
optarg=`expr "X$option" : 'X[^=]*=\(.*\)'`
;;
* )
optarg=""
;;
esac
case $option in
-h | --h | -help | --help )
echo "Usage:"
echo " $0 [options]"
echo "Options:"
echo " -h, -help Show this help"
echo " -prefix=PREFIX Install architecture-independent files in PREFIX"
echo " [/usr/local]"
echo " -exec-prefix=EPREFIX Install architecture-dependent files in EPREFIX"
echo " [PREFIX]"
echo " -with-system-zlib Use the system-supplied zlib"
echo " -with-system-libpng Use the system-supplied libpng"
echo "Environment variables:"
echo " CC C compiler command"
exit 0
;;
-prefix=* | --prefix=* )
prefix=$optarg
;;
-prefix | --prefix )
prefix=$2
shift
;;
-exec-prefix=* | --exec-prefix=* | -exec_prefix=* | --exec_prefix=* )
exec_prefix=$optarg
;;
-exec-prefix | --exec-prefix | -exec_prefix | --exec_prefix )
exec_prefix=$2
shift
;;
-with-system-zlib | --with-system-zlib )
with_system_zlib=1
;;
-with-system-libpng | --with-system-libpng )
with_system_libpng=1
;;
* )
echo "Unknown option: $option"
echo "Type \"$0 -help\" for help"
exit 64 # EX_USAGE
;;
esac
done
update_re="
s:^\\(prefix *= *\\).*\$:\\1$prefix:
s:^\\(exec_prefix *= *\\).*\$:\\1$exec_prefix:
"
if test $with_system_zlib -ne 0
then
update_re_zlib='
s:\(.\)-I\$(ZDIR):\1:g
s:\(.\)\$(ZDIR)/\$(ZLIB):\1:g
/^SYSLIBS *=/s:$: -lz:
'
fi
if test $with_system_libpng -ne 0
then
update_re_libpng='
s:\(.\)-I$(PNGDIR):\1:g
s:\(.\)$(PNGDIR)/$(PNGLIB):\1:g
/^SYSLIBS *=/s:$: -lpng:
'
fi
for makefile in \
src/scripts/unix.mak src/scripts/gcc.mak \
lib/pngxtern/scripts/unix.mak lib/pngxtern/scripts/gcc.mak
do
sed -e "$update_re" -e "$update_re_zlib" -e "$update_re_libpng" \
$makefile.in > $makefile
done
test=conftest$$
cat > $test.c <<EOM
int hello() { return 42; }
EOM
test -z "$CC" && echo "Checking for gcc..."
cc="${CC-gcc}"
case "$cc" in
*gcc* )
gcc=1
;;
esac
if test $gcc -ne 0 && ($cc -c $cflags $test.c) 2>/dev/null
then
CC="${CC-gcc}"
#MAKEFILE="${MAKEFILE-gcc.mak}"
MAKEFILE=gcc.mak
else
CC="${CC-cc}"
#MAKEFILE="${MAKEFILE-unix.mak}"
MAKEFILE=unix.mak
fi
rm -f $test.c $test.o
update_re="
s:@MAKEFILE@:scripts/$MAKEFILE:g
s:@CC@:$CC:g
s:@prefix@:$prefix:
s:@exec_prefix@:$exec_prefix:
"
sed "$update_re" Makefile.in > Makefile
sed "$update_re" src/Makefile.in > src/Makefile
if test $with_system_zlib -eq 0
then
echo "Configuring zlib..."
(cd lib/zlib && ./configure --static)
if test $? -ne 0
then
echo "Could not configure: zlib"
exit 1
fi
fi
#if test $with_system_libpng -eq 0
#then
# echo "Configuring libpng..."
# (cd lib/libpng && ./configure)
# if test $? -ne 0
# then
# echo "Could not configure: libpng"
# exit 1
# fi
#fi
CAVEAT EMPTOR
=============
(known bugs, problems or limitations)
Legend
------
- Minor bug, limitation, or incompletely-implemented feature.
! Bug that may lead to a behavior different than expected,
but without any serious consequence.
!! Bug that may cause accidental data loss, security hazard,
or another serious consequence.
* Another problematic issue, that is not necessarily a bug.
Version 0.6.4 14-mar-2010
-------------
- Lossless image reductions are not completely implemented.
(This does NOT affect the integrity of PNG 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
color spaces (grayscale, RGB and RGBA).
- Metadata is not imported from the external image formats.
- There is no support for pipes or streams.
This diff is collapsed.
This diff is collapsed.
File added
This diff is collapsed.
This diff is collapsed.
<!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>Thanks!</title>
</head>
<body>
<h2>Acknowledgements</h2>
<div>
The author is indebted to the following people.
OptiPNG would not exist without their work.
<p>
<table border="0" width="100%">
<tbody>
<tr>
<td width="25%">Mark Adler</td>
<td>for developing the zlib library</td>
</tr>
<tr>
<td width="25%">Thomas Boutell</td>
<td>for the idea of creating the PNG image format (it's all his fault!)</td>
</tr>
<tr>
<td width="25%">Adam M. Costello</td>
<td>for co-developing cexcept, an exception-handling interface for C</td>
</tr>
<tr>
<td width="25%">Jean-loup Gailly</td>
<td>for devising a patent-free deflation algorithm
and for developing the zlib library</td>
</tr>
<tr>
<td width="25%">Phil Katz</td>
<td>for inventing ZIP (PKZip) and the deflation algorithm</td>
</tr>
<tr>
<td width="25%">David Koblas</td>
<td>GIF support is derived from the giftopnm tool</td>
</tr>
<tr>
<td width="25%">Miyasaka Masaru</td>
<td>BMP support is derived from the bmptopng tool</td>
</tr>
<tr>
<td width="25%">David Salomon</td>
<td>for writing the most comprehensive data compression reference book</td>
</tr>
<tr>
<td width="25%">Jason Summers</td>
<td>image reductions are inspired from the pngrewrite tool</td>
</tr>
<tr>
<td width="25%">Glenn Randers-Pehrson</td>
<td>OptiPNG is inspired from the pngcrush tool(!)</td>
</tr>
<tr>
<td width="25%">The PNG Development Group</td>
<td>for developing the PNG format and the libpng library
and also for countless help via the emailing list :-)</td>
</tr>
<tr>
<td width="25%">The Information Theory founders</td>
<td>Shannon, Huffman, Ziv, Lempel et al., you will never be forgotten!</td>
</tr>
</tbody>
</table>
</div>
<p>
<hr>
<p>
<div>
There are also many people who contributed to the OptiPNG project.
The author is grateful to all of them.
<br>
This list is by no means complete. If you made a contribution, but your name is
not listed here, please don't be shy and
<a href="http://sourceforge.net/sendmessage.php?touser=24402">let him know</a>.
<br>
The author is particularly aware of the ever-increasing grup of amazing
volunteers who either create new ports and packages, or take over the
maintenance of the existing ones. They are unsung heroes. Regardless whether
they are on this list or not (yet), a big THANKS goes to them!
<p>
<table border="0" width="100%">
<tbody>
<tr>
<td width="25%">Peter Ahlstrom</td>
<td>for experimenting with the zlib parameters,
and for providing useful test data</td>
</tr>
<tr>
<td width="25%">Emmanuel Andry</td>
<td>for maintaining the Mandriva Linux port</td>
</tr>
<tr>
<td width="25%">Piotr Bandurski</td>
<td>for maintaining the Amiga port,
and for suggesting a feature improvement</td>
</tr>
<tr>
<td width="25%">Fabien Barbier</td>
<td>for fixing a Unicode build issue on Windows</td>
</tr>
<tr>
<td width="25%">Fabrizio Bartoloni</td>
<td>for maintaining the MorphOS port</td>
</tr>
<tr>
<td width="25%">Pascal Bleser</td>
<td>for maintaining the SUSE Linux port</td>
</tr>
<tr>
<td width="25%">Stefan Brüns</td>
<td>for contributing a security fix</td>
</tr>
<tr>
<td width="25%">James Buren</td>
<td>for maintaining the Frugalware Linux port</td>
</tr>
<tr>
<td width="25%">Adam Ciarcinski</td>
<td>for maintaining the pkgsrc package</td>
</tr>
<tr>
<td width="25%">James H. Cloos, Jr.</td>
<td>for being the first user to report a defect</td>
</tr>
<tr>
<td width="25%">Christian Davideck</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Andrew C. E. Dent</td>
<td>for experimenting with various compression parameters,
and for providing useful test data</td>
</tr>
<tr>
<td width="25%">Matthew Fearnley</td>
<td>for reporting several defects and limitations,
and for contributing a reduction improvement</td>
</tr>
<tr>
<td width="25%">Petr Gajdos</td>
<td>for maintaining the SUSE Linux port</td>
</tr>
<tr>
<td width="25%">Nicolas Le Gland</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Tero Grundström</td>
<td>for reporting a build problem</td>
</tr>
<tr>
<td width="25%">Larry Hastings</td>
<td>for suggesting a performance improvement, for reporting a defect,
and for providing useful test data</td>
</tr>
<tr>
<td width="25%">Tristan Heaven</td>
<td>for maintaining the Gentoo Linux port</td>
</tr>
<tr>
<td width="25%">Jukka Heino</td>
<td>for maintaining the Crux Linux port</td>
</tr>
<tr>
<td width="25%">Max Horn</td>
<td>for maintaining the Mac OS X (Fink) port</td>
</tr>
<tr>
<td width="25%">Thomas Hurst</td>
<td>for maintaining the FreeBSD port</td>
</tr>
<tr>
<td width="25%">Joachim Kluge</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Bill Koch</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Niels de Koning</td>
<td>for contributing memory leak fixes</td>
</tr>
<tr>
<td width="25%">Michael Krishtopa</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Vincent Lefevre</td>
<td>for maintaining the Mac OS X DarwinPort,
and for suggesting a feature</td>
</tr>
<tr>
<td width="25%">Vitaly Lipatov</td>
<td>for maintaining the ALT Linux port</td>
</tr>
<tr>
<td width="25%">Alexander Lucas</td>
<td>for suggesting a feature</td>
</tr>
<tr>
<td width="25%">Till Maas</td>
<td>for maintaining the Fedora Linux port,
and for valuable contributions and feedback</td>
</tr>
<tr>
<td width="25%">Brian McQuade</td>
<td>for contributing a security fix</td>
</tr>
<tr>
<td width="25%">Nehal Mistry</td>
<td>for suggesting various features</td>
</tr>
<tr>
<td width="25%">Dirk Mueller</td>
<td>for maintaining the SUSE Linux port</td>
</tr>
<tr>
<td width="25%">Gustavo De Nardin</td>
<td>for maintaining the Mandriva Linux port</td>
</tr>
<tr>
<td width="25%">Nelson A. de Oliveira</td>
<td>for maintaining the Debian Linux port,
and for valuable contributions and feedback</td>
</tr>
<tr>
<td width="25%">Tavis Ormandy</td>
<td>for maintaining the Gentoo Linux port</td>
</tr>
<tr>
<td width="25%">Martin Packman</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Dimitri Papadopoulos</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Aaron Reitz</td>
<td>for reporting a platform-specific build problem</td>
</tr>
<tr>
<td width="25%">Ryan Schenk</td>
<td>for writing PNGpong, a Dashboard widget for Mac OS X</td>
</tr>
<tr>
<td width="25%">Ville Skyttä</td>
<td>for maintaining the Fedora Linux port</td>
</tr>
<tr>
<td width="25%">Roy Tam</td>
<td>for reporting a defect</td>
</tr>
<tr>
<td width="25%">Juhapekka Tolvanen</td>
<td>for suggesting various script improvements</td>
</tr>
<tr>
<td width="25%">Dmitry Vlasko</td>
<td>for writing a configurable Windows shell integration utility</td>
</tr>
<tr>
<td width="25%">Funda Wang</td>
<td>for maintaining the Mandriva Linux port</td>
</tr>
<tr>
<td width="25%">Liang Zhao</td>
<td>for reporting a platform-specific build problem</td>
</tr>
<tr>
<td width="25%">[akJ]</td>
<td>for writing an Eclipse RCP utility</td>
</tr>
<tr>
<td width="25%">[amake]</td>
<td>for writing pngcrusher, a Mac OS X front-end</td>
</tr>
<tr>
<td width="25%">[Baldelario]</td>
<td>for maintaining the Slackware Linux port</td>
</tr>
<tr>
<td width="25%">[I Like Pi]</td>
<td>for writing a configurable Paint.NET plugin</td>
</tr>
<tr>
<td width="25%">[LaughingMan]</td>
<td>for suggesting a feature, and for reporting a defect</td>
</tr>
<tr>
<td width="25%">[warriant]</td>
<td>for suggesting the use of UPX to pack the Windows executable</td>
</tr>
</tbody>
</table>
</div>
<p>
<hr>
<div>
Last updated: 14&nbsp;Mar&nbsp;2010 by Cosmin Truţa.
<br>
<a href="http://optipng.sourceforge.net/">&lt;&lt;&nbsp;<b>OptiPNG Home Page</b></a>
</div>
</body>
</html>
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/
Currently it is possible to optimize an entire directory as:
optipng dir/*.png
provided that file globbing works, either at the shell level (Unix)
or in the program (linked with wildargs.obj on Windows).
- Improved support for reading external image formats
(e.g. compressed TIFF or other image formats).
- Support for conversion to a desired bit depth and color type:
optipng -b16 -c6 ...
- Support for handling metadata, e.g.:
optipng -meta set:tEXt=<keyword>,<text> # add/update chunk
optipng -meta set:sRGB=0 # add/update chunk
optipng -meta select:all # keep all chunks
optipng -meta reject:all # delete all chunks
optipng -meta select:std2003 # keep all standard chunks
optipng -meta select:public # keep all public chunks
optipng -meta reject:private # delete all private chunks
optipng -meta reject:hIST,sPLT # delete hIST and sPLT
optipng -meta select:visual # keep gAMA, cHRM, sRGB, ...
optipng -meta reject:visual # delete gAMA, cHRM, sRGB, ...
optipng -meta select:textual # keep tEXt, zTXt, iTXt
optipng -meta reject:textual # delete tEXt, zTXt, iTXt
optipng -meta reject:gif # delete gIFg, gIFt, gIFx
optipng -meta load:<file> # load chunks from file
optipng -meta store:<file> # store chunks in file
- 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.
/*
* gifdump.c
*
* Copyright (C) 2003-2009 Cosmin Truta.
* This software is distributed under the same licensing and warranty terms
* as gifread.c.
*/
#include <stdio.h>
#include "gifread.h"
static int exitCode = 0;
void GIFDump(const char *filename)
{
FILE *stream;
struct GIFScreen screen;
struct GIFImage image;
struct GIFExtension ext;
struct GIFGraphicCtlExt graphicExt;
stream = fopen(filename, "rb");
if (stream == NULL)
{
fprintf(stderr, "Error: Can't open %s\n", filename);
exitCode = 1;
return;
}
printf("File: %s\n", filename);
GIFReadScreen(&screen, stream);
printf("Screen: %u x %u\n", screen.Width, screen.Height);
if (screen.GlobalColorFlag)
printf(" Global colors: %u\n", screen.GlobalNumColors);
if (screen.PixelAspectRatio != 0)
printf(" Pixel aspect ratio = %u\n", screen.PixelAspectRatio);
GIFInitImage(&image, &screen, NULL);
GIFInitExtension(&ext, &screen, NULL, 0);
for ( ; ; )
{
switch (GIFReadNextBlock(&image, &ext, stream))
{
case GIF_TERMINATOR: /* ';' */
printf("\n");
fclose(stream);
return;
case GIF_IMAGE: /* ',' */
printf("Image: %u x %u @ (%u, %u)\n",
image.Width, image.Height, image.LeftPos, image.TopPos);
if (image.LocalColorFlag)
printf(" Local colors: %u\n", image.LocalNumColors);
printf(" Interlaced: %s\n", image.InterlaceFlag ? "YES" : "NO");
break;
case GIF_EXTENSION: /* '!' */
if (ext.Label == GIF_GRAPHICCTL)
{
GIFGetGraphicCtl(&ext, &graphicExt);
printf("Graphic Control Extension: 0x%02X\n", ext.Label);
printf(" Disposal method: %u\n", graphicExt.DisposalMethod);
printf(" User input flag: %u\n", graphicExt.InputFlag);
printf(" Delay time : %u\n", graphicExt.DelayTime);
if (graphicExt.TransparentFlag)
printf(" Transparent : %u\n", graphicExt.Transparent);