Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paperclip: Specify jpeg / jpg quality

Is there an easy way to specify the jpeg quality of an image to be saved in the paperclip plug-in for rails 3?

like image 407
chalmers Avatar asked Jan 10 '11 07:01

chalmers


1 Answers

Yes, it is pretty easy. Paperclip has an option called :convert_options which can be used for that purpose. It takes parameters that ImageMagick / Ghostscript can accept.

Here is an example:

class User < ActiveRecord::Base
  has_attached_file :avatar, :styles => { :thumb => ["100x100>", :jpg] },
                             :convert_options => { :thumb => "-quality 92" }
like image 115
DanneManne Avatar answered Nov 03 '22 09:11

DanneManne