Compressing images directly on web server – Better Pagespeed tips

for png, install on centos using command

yum install optipng

for a single image

optipng -o5 filename.png

move to folder in which pngs are stored and use the following command:

for i in *.png; do optipng -o7 -strip all  -quiet "$i"; done

this will overwrite all pngs, o7 is switch for number of tries. o5 will be less time consuming though. -quiet makes it muted, outputs nothing.
-strip all will try to remove all meta data.
you can use -preserve to preserve the modification date.
also try -keep, if you want to save backup of each file


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *