This gem allows you to optimize your JPEG uploads with jpegtran using the jpegtran-ruby gem.
Add this line to your application's Gemfile:
gem 'carrierwave-jpegtran'
And then execute:
$ bundle
Or install it yourself as:
$ gem install carrierwave-jpegtran
To add JPEG optimization to your CarrierWave uploader, you need to include the module and apply the optimization:
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::Jpegtran
process :optimize # apply to all versions
# or
version :thumbnail do
process optimize: { copy: :none } # to a single image version with the option `-copy none`
end
end
After checking out the repo, run bin/setup
to install dependencies.
You can also run bin/console
for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome.
The gem is available as open source under the terms of the MIT License.