Skip to content

Instantly share code, notes, and snippets.

@a-chernykh
Created July 1, 2011 12:50
Show Gist options
  • Save a-chernykh/1058477 to your computer and use it in GitHub Desktop.
Save a-chernykh/1058477 to your computer and use it in GitHub Desktop.
Change image quality with carrierwave and mini_magick
# put this in config/initializers/carrierwave.rb
module CarrierWave
module MiniMagick
def quality(percentage)
manipulate! do |img|
img.quality(percentage)
img = yield(img) if block_given?
img
end
end
end
end
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
process :quality => 85
version :medium do
process :quality => 85
end
end
@coolstorybro
Copy link

Cool! Thanks for this example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment