Files
libpng/pngzop
2013-03-11 18:01:18 -05:00

25 lines
710 B
Bash
Executable File

#!/bin/sh
# pngzop file.png > file_pz.idat
# For use in the pngzop project
# Copyright 2013 by Glenn Randers-Pehrson
# Released under the pngcrush license (equivalent to the libpng license)
# From a PNG file, finds the smallest resulting compressed IDAT
# data from zopfli compression of filter types 0 through 4 and
# "adaptive" (f5) filtering.
# To do: replace the IDAT chunks in the source PNG file with the
# result.
for f in 0 1 2 3 4 5
do
rm -f pngzop-f$f-$$.png
pngcrush -q -m 1 -f $f -force $1 pngzop-f$f-$$.png
pngidat pngzop-f$f-$$.png
zopfli --i25 --zlib pngzop-f$f-$$.idat
done
echo `ls -S pngzop-f?-$$.idat.zlib | tail -1`
rm pngzop-f?-$$.png pngzop-f?-$$.idat pngzop-f?-$$.idat.zlib