Search code examples
imageimagemagickmogrify

Image compression using Image Magick mogrify problems


Im not an expert in this field at all. Im trying to re-size batch images from the web and for the most part it is working great. I am running into images that are huge in size and re-sizing and compressing through mogrify just isnt working.

Ive used a standard desktop image re-sizer and it re-sizes the compresses the image to a reasonable size. The size is 500kb+ and they re-size it to 20kb. My mogrify cmd is leaving it just shy of 500kb.

Here is an example image http://c.shld.net/rpx/i/s/pi/mp/3962/225051167p?src=http%3A%2F%2Fwww.petraimages.com%2F500x500%2FTHRFBB1000P6.jpg&d=2ae05e1b6fd7950ae4fbbe2cc9039c0265073173

I am using the trim, resize (250x250), compress (JPEG), format (JPEG) cmd line args for mogrify. Ive tried playing around with the compression but no luck.


Solution

  • Seems your example picture consists mostly of an ICC color profile. This can be removed by adding

    +profile icc

    to the commandline options of mogrify or convert, for example

    convert example.jpg +profile icc example_out.jpg
    

    reduces the file size to 28kb.

    convert example.jpg +profile icc +profile xmp example_out.jpg
    

    results in 12 kb (even without reduction of pixel size or colors).