Heads up! This post was written 11 years ago. Some information might be outdated or may have changed since then.
Very quick script for converting all png and gif files in directory to jpeg with image magick.
set -e   
dir=/var/www/default/public_images   

for ext in png gif; do   
    for i in `find "$dir"  -type f -regex '.*'$ext `; do 		
        ( 	
            filename=${i%.*}  		
            convert "$i" -quality 90 -strip "$filename.jpg" 		
            echo "$filename" 
        ) 	
    done 
done

Back to all posts