Skip to content

Instantly share code, notes, and snippets.

@wiemann
Created December 6, 2010 13:20
Show Gist options
  • Save wiemann/730273 to your computer and use it in GitHub Desktop.
Save wiemann/730273 to your computer and use it in GitHub Desktop.
carrierwave minimagick quality parameter to set jpeg quality
# rails carrierwave initializer that gives you a quality option in your uploader. use:
# version :medium do
# process :resize_to_fit => [640, 480]
# process :quality => 95
# end
module CarrierWave
module MiniMagick
def quality(percentage)
manipulate! do |img|
img.write(current_path){ self.quality(percentage) }
img = yield(img) if block_given?
img
end
end
end
end
@Paxa
Copy link

Paxa commented Apr 1, 2011

Thank you!

@a-chernykh
Copy link

Does not works for me. This one works:

https://gist.github.com/1058477

@diegosomar
Copy link

@andreychernih This solution works for me too!

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