I am running Ruby on Rails 3 and I would like to reduce the quality of an uploading image using the Paperclip plugin/gem. How can I do that?
At this time in my model file I have:
has_attached_file :avatar,
:styles => {
:thumb => ["50x50#", :jpg],
:medium => ["250x250#", :jpg],
:original => ["600x600#", :jpg] }
that will convert images in to the .jpg
format and will set dimensions.
As James says, once you figure out the correct arguments to pass to ImageMagick's
convert
by experimenting on the command line, you can pass these in to Paperclip through theconvert_options
option as in James' example.If you have multiple arguments, pass them in as an array. Here's an example which I laboured over for a while:
Except
-quality
, the-strip
option ofImageMagick
can remove all profile and other fluff from the image which may reduce more sizeTry using convert_options.
From the paperclip wiki, there's an option for quality: