This gem allows you to simply optimize images via jpegoptim or OptiPNG.
Tested against ruby 1.8.7, 1.9.2, 1.9.3, ruby-head, jruby-18mode, jruby-19mode, jruby-head, rbx-18mode, rbx-19mode, and ree
[



-
jpegoptim, which can be installed from freecode.com
-
OptiPNG, which can be installed from sourceforge.net
Or install the utilities via homebrew:
$ brew install optipng jpegoptimThen add this line to your application's Gemfile:
gem 'image_optimizer'
And then execute:
$ bundleOr install it yourself as:
$ gem install image_optimizerOptiPNG is a PNG optimizer that recompresses image files to a smaller size without losing any information and performs PNG integrity checks and corrections.
ImageOptimizer.new('path/to/file.png').optimizejpegoptim provides lossless optimization for JPEG files based on optimizing the Huffman tables. all jpegs will be progressively optimized for a better web experience
ImageOptimizer.new('path/to/file.jpg').optimizePass an optional 'quality' parameter to target a specific JPG quality level (0-100), or pass -1 for lossless optimization. PNGs will ignore the quality setting
ImageOptimizer.new('path/to/file.jpg', 80).optimize- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request