This gem allows you to compress lossless images with the help of ffmpeg library on carrierwave gem. This library is inspired from carrierwave-imageoptimizer.
Then add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install carrierwave-optimize-image
To add image compression to your CarrierWave uploader, first include the module:
class MyUploader < CarrierWave::Uploader::Base include CarrierWave::OptimzeImage ... end
Then apply to eacg versions via:
class TestUploader < CarrierWave::Uploader::Base ... process optimize: [level: 10] end
Pass an optional
level parameter to specific lossy image quality level (0-100), default is lossless level is 30.
The lessel the value, the better the qaulity.
To use this gem ffmpeg library should be install on you system or ypu can follow the below steps to install it.
sudo apt-get install ffmpeg
brew install ffmpeg
- 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