dragonfly mozjpeg

Plugin for mozilla's cjpeg and jpegtran encoders for dragonfly.

Installation

Add this line to your application's Gemfile:

gem 'dragonfly_mozjpeg'

And then execute:

$ bundle

Or

$ gem install dragonfly_mozjpeg

Usage

Dragonfly.app.configure do
  plugin :mozjpeg
end

Overwrite default binaries, For example:

Dragonfly.app.configure do
  plugin :mozjpeg,
    cjpeg:    '/opt/mozjpeg/bin/cjpeg',
    jpegtran: '/opt/mozjpeg/bin/jpegtran'
end

Processors

Lossy

Lossy compression with cjpeg, and you can pass cjpeg options. For example:

image.lossy([:noovershoot, quality: "70,60", sample: "2x2", smooth: 10])

Lossless

Lossless compression with jpegtran, jpegtran and you can pass options, For example:

image.lossless([:grayscale, :trim, copy: :none, flip: :horizontal])

Contributing

Bug reports and pull requests are welcome at https://github.com/jurema/dragonfly_mozjpeg.

License

This gem is available as open source under the terms of the MIT License, see LICENSE.txt.