find . -iname '*.gif' -exec gifsicle -O2 -b {} \;
( All of these tools are suggested here: http://docs.moodle.org/en/Performance#Moodle_Image_Optimization )