One easy way of reducing website load time is by optimizing your images, which is what PNGCrush does. PNG graphics are often more bloated than they need to be so using PNGCRUSH should be obvious.
Basic usage flags don’t allow for recursive directories so needs to be put inside a loop.
-brute
crushes the image with all ~114 possible methods and picks the smallest.
-reduce
does lossless colour type or bit depth reduction. Eg, if there are only 5 unique colours, there’s no need for a colour palette of 256.
Running script without parameters will do all files files from current working directory, or first param can be location. Example usage:
$ recursivepngcrush .
$ recursivepngcrush ~/images/folder/
#!/bin/sh
FILTER=${1:-"."};
TFILE="temp.png";
for PNG in `find $FILTER -name "*.png"`;
do
echo "Crushing $PNG"
pngcrush -brute -reduce "$PNG" $TFILE
mv -f $TFILE $PNG
done;
FILTER=${1:-"."};
TFILE="temp.png";
for PNG in `find $FILTER -name "*.png"`;
do
echo "Crushing $PNG"
pngcrush -brute -reduce "$PNG" $TFILE
mv -f $TFILE $PNG
done;

Thanks! You’re missing a period in `find . $1 -name “*.png”`
Ah! I’d been using it with first param being a location, but have tweaked it now so running without params does $CWD