2020-01-02 22:04:12 +01:00
|
|
|
#!/bin/sh
|
2017-09-02 23:01:09 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
for f in `find $(dirname $0)/../app/src/ -type f -name \*.png`; do
|
2020-01-02 22:04:12 +01:00
|
|
|
printf "\n\n=====================================================================\n"
|
2017-09-02 23:01:09 +02:00
|
|
|
echo $f | grep -Eo '\.9\.png$' && continue # do not optimized 9-patch, it breaks them
|
2020-01-02 22:04:12 +01:00
|
|
|
singlefile=$(mktemp)
|
|
|
|
zopflifile=$(mktemp)
|
|
|
|
aapt singleCrunch -v -i $f -o $singlefile || true
|
|
|
|
zopflipng --iterations=50 --keepchunks=iCCP --lossy_transparent --splitting=3 -my $f $zopflifile || true
|
|
|
|
if [ -s $singlefile ] && [ -s $zopflifile ]; then
|
|
|
|
ls -l $singlefile $zopflifile
|
|
|
|
if [ $(stat --format="%s" $singlefile) -lt $(stat --format="%s" $zopflifile) ]; then
|
|
|
|
echo "Using aapt singleCrunch for $f"
|
|
|
|
mv $singlefile $f
|
|
|
|
else
|
|
|
|
echo "Using zopflipng for $f"
|
|
|
|
mv $zopflifile $f
|
|
|
|
fi
|
|
|
|
elif [ -s $singlefile ] && [ ! -s $zopflifile ]; then
|
|
|
|
mv $singlefile $f
|
|
|
|
elif [ ! -s $singlefile ] && [ -s $zopflifile ]; then
|
|
|
|
mv $zopflifile $f
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
exiftool -all= $f
|
|
|
|
rm -f $singlefile $zopflifile
|
2017-09-02 23:01:09 +02:00
|
|
|
done
|
2018-03-07 23:16:16 +01:00
|
|
|
|
|
|
|
for f in metadata/*/images/*Screenshots/*.png; do
|
|
|
|
exiftool -all= $f
|
|
|
|
tmpfile=$(mktemp)
|
|
|
|
(zopflipng --filters=01234mepb --lossy_8bit --lossy_transparent -y $f $tmpfile && mv $tmpfile $f) &
|
|
|
|
done
|