mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[pngzop] Added "pngzop_smallest.sh" script
This commit is contained in:
42
pngzop_smallest.sh
Executable file
42
pngzop_smallest.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
# For use in the pngzop project
|
||||
# Copyright 2013 by Glenn Randers-Pehrson
|
||||
# Released under the pngcrush license (equivalent to the libpng license)
|
||||
|
||||
# Selects the smaller of file.zdat (extracted from a PNG) or
|
||||
# file.idat.zlib (same but recompressed with zopfli)
|
||||
|
||||
# picksmallest file1 file...
|
||||
|
||||
# for use on platforms that do not have "ls -S"
|
||||
|
||||
smallest=$1
|
||||
smallsize=`ls -l $1 | sed -e "
|
||||
s/[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
//" -e "s/[ ].*//"`
|
||||
|
||||
shift
|
||||
|
||||
for x in $*
|
||||
do
|
||||
file=$1
|
||||
shift
|
||||
|
||||
size=`ls -l $file | sed -e "
|
||||
s/[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
[^ ]*[ ]*\
|
||||
//" -e "s/[ ].*//"`
|
||||
|
||||
if [ $smallsize -gt $size ] ; then
|
||||
smallest=$file
|
||||
smallsize=$size
|
||||
fi
|
||||
done
|
||||
|
||||
echo $smallest
|
||||
Reference in New Issue
Block a user