Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use mogrify to modify images on a web server UNIX
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.
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (4 votes cast)
 
[9,481 views]  

Use mogrify to modify images on a web server | 13 comments | Create New Account
Click here to return to the 'Use mogrify to modify images on a web server' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
!!!
Authored by: magitekkn on Aug 07, '03 10:12:41AM

So that's why IE6 on my old dell (in my pre-mac days) would always act screwy at spymac.com.... madness



[ Reply to This | # ]
Or use jpegtran / jhead
Authored by: vogunaescht on Aug 07, '03 10:35:41AM
The shell command "jpegtran" is included with libjpeg and can be used to strip extra markers from jpeg files (and more). I use

jpegtran -o -p -copy none outputfile.jpg

to optimize the jpeg header, convert the jpeg (lossless) to the smaller progressive jpeg format and remove all extra markers like comments.

jhead can do a lot with exif headers, i just use it to rename digicam pictures to the date/time the pic was taken, autorotate it and then remove the header with

jhead -de file.jpg

jhead can do a lot more, btw.

[ Reply to This | # ]
Use mogrify to modify images on a web server
Authored by: cidion on Aug 07, '03 10:46:25AM
Will this command actually change the size of my pictures? Right now they are all the right dimentions and everything, and I'm a little nervous that what I'm trying to do will make them like...90ox wide or something...or super compressed or something.

Now, i also am having problems finding where morgify is. the Locate Morgify command cannot run because I'm not root.

I've contacted the folks at www.hostforweb.com (my server) but they don't know. decent hosting, but slow support.

Anyone know how to find the morgify command without being root?

---
-- cidion

[ Reply to This | # ]

Use mogrify to modify images on a web server
Authored by: comodin on Aug 07, '03 01:13:27PM

why u dont use ur mac to moify the pics and then ftp the files to ur webserver? ;)



[ Reply to This | # ]
Use mogrify to modify images on a web server
Authored by: cidion on Aug 07, '03 02:56:43PM

Mainly because they are already on the server that I want them to be on, with captions, and the correct order...etc(using Gallery) and... I don't have Image::Magick on my mac.

---
-- cidion



[ Reply to This | # ]
Use mogrify to modify images on a web server
Authored by: comodin on Aug 08, '03 01:38:56PM
oh sure, was just an idea to install the imagemagick-package from fink or from www.entropy.ch and then get a backup of the complete "Albums"-folder of ur Gallery to ur local disk for manipulation. may be faster than waiting for ur ISP :) second thought was, its not a bad idea to make manipulations first on a clone of ur livesystem :)

[ Reply to This | # ]
Use mogrify to modify images on a web server
Authored by: MtnBiker on Aug 07, '03 01:47:11PM

Mogrify - spelling

---
Hermosa Beach, CA USA



[ Reply to This | # ]
Thranks! That might jrust help.
Authored by: cidion on Aug 07, '03 03:02:02PM

yes... me bad speller. Must learn Engrish.

=)

I'll check my spelling. thanks for the hint.

---
-- cidion



[ Reply to This | # ]
Got it
Authored by: cidion on Aug 08, '03 01:17:44PM

I didn't have adequite permissions to use the locate command, but a friend of mine at variaprint.com told me about the "whereis" command, and it worked fine...

I can't tell if it fixed the IE6 problem because I don't own a wintel machine.

---
-- cidion



[ Reply to This | # ]
re: find
Authored by: koelling on Aug 07, '03 01:47:20PM

This hint recommends searching for .JPG but alternatively one could change -name to -iname. This is the case-insensitive flag.



[ Reply to This | # ]
Mogrify-How tell if needed
Authored by: MtnBiker on Aug 07, '03 01:57:00PM

How can I tell if the jpg's on my server need this treatment? Or if they have any extra information?


I don't have shell access so couldn't do this on the uploaded jpg's, but I did upload all the pictures, so have copies on my local G4. I also avoid using Terminal as I'm not real comfortable with it.

---
Hermosa Beach, CA USA



[ Reply to This | # ]
Mogrify-How tell if needed
Authored by: MtnBiker on Aug 07, '03 02:14:57PM

Studying the related thread I saw reference to Graphic Converter.

With GC's Get Info I only see one tab with size and resolution information whereas the originals had two tabs of EXIF information. Will the color profile information show up in this GC Get Info?

---
Hermosa Beach, CA USA



[ Reply to This | # ]
identify -verbose
Authored by: jecwobble on Aug 07, '03 04:26:53PM

I found this at the ImageMagick site: "Use identify -verbose to find out what profiles are in the image file"

I realize you said you weren't comfortable using the Terminal, but if you're interested in using mogrify, then identify shouldn't be a stretch.

[ Reply to This | # ]