Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@Paxa Paxa commented Apr 1, 2011

Thank you!

@andreychernih

This comment has been minimized.

Copy link

@andreychernih andreychernih commented Jul 1, 2011

Does not works for me. This one works:

https://gist.github.com/1058477

@diegosomar

This comment has been minimized.

Copy link

@diegosomar diegosomar commented Jun 8, 2018

@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