Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (42 sloc) 1.95 KB


A command utility that compresses images in the background for our customers. Outputs a JSON file with detailed information on the conversion, and a .txt file listing the files processed.


You'll need the RMagick gem installed first, on OSX you may need to install imagemagick before you can do that.

Meeting the requirements on Mountain Lion

$ gem install rmagick

If this complains about imagemagick not being found, install Homebrew (

$ brew install imagemagick

To use the EXIF option, you must have jhead installed, see below for more information


$ gem install smushkid


-q no STDOUT ( except for single file JSON )
-b create backup of any optimized files  ( prefixes with original- )
-e add EXIF tag to prevent double processing ( must have jhead installed )


$ smushkid path/to/directory desired_quality -b -q -e


$ smushkid wp-content/uploads 75


to prevent double processing on subsequent script runs, tag the EXIF metadata with the string "smushkid" using jhead:

GH mirror here:

eventually this would be nice to have baked-into RMagick or at least use a ruby wrapper like this one:

directory = directory you want to process JPG images in

desired_quality = JPG compression value ( or % quality )


this script strips metadata from the source image, then quantizies the color map at 32 bit, and compresses to desired quality level.

Information about RMagick here:

Read more about image quantization: