Created
December 6, 2010 13:20
-
-
Save wiemann/730273 to your computer and use it in GitHub Desktop.
carrierwave minimagick quality parameter to set jpeg quality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!