Use mogrify to modify images on a web server

Aug 07, '03 09:23:00AM

Contributed by: jrigby

Seeing the hint about using mogrify to strip the color profiles iPhoto saves into JPEG files destined for the web, it reminded of a command I always run on my web directory to trim JPEG file sizes. This also fixes a problem that Windows IE has with some JPEGs saved with color profiles on a Mac. The JPEGs would show up absolutely fine on a Mac browser, but would crash Windows IE, preventing it from loading any addidional pics until IE was restarted. This drove me nuts a while back, as I had over 10,000 JPEGs to fix.

If you have shell access to your web root and ImageMagick installed, run the following command to trim all your JPEG filesizes and prevent potential Windows IE problems. First cd to the web root, then type:

find . -name "*.jpg" -print -exec /usr/local/bin/mogrify +profile "*" {} \;
/usr/local/bin/mogrify is where my mogrify command is located; it may be different on your system. Just do a locate mogrify to see where it lives.

Depending on the size of your site, it may take a while. you may also want to search for *.JPG, as the find comand is case sensitive.

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030805171416880