Skip to content

dmeremyanin/carrierwave-jpegtran

Repository files navigation

CarrierWave Jpegtran optimizer

This gem allows you to optimize your JPEG uploads with jpegtran using the jpegtran-ruby gem.

travis

Installation

Add this line to your application's Gemfile:

gem 'carrierwave-jpegtran'

And then execute:

$ bundle

Or install it yourself as:

$ gem install carrierwave-jpegtran

Usage

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

Development

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.

Contributing

Bug reports and pull requests are welcome.

License

The gem is available as open source under the terms of the MIT License.

About

Optimize your JPEG uploads with jpegtran

Resources

License

Stars

Watchers

Forks

Packages

No packages published