Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save image as progressive image using paperclip?

How to save image as progressive image using paperclip/Imagemagick?

Code I am using:

has_attached_file :photo, {
      :styles => {
          :medium => ["200x200#", :jpg] ,
          :small => ["192x256#", :jpg], 
          :thumb => ["50x50#", :jpg],
          :small_thumb =>["30x30#", :jpg] 
        },
        :convert_options => { 
          :medium => "-quality 60",
          :small => "-quality 60",
          :thumb => "-quality 60",
          :small_thumb => "-quality 60" 
        },
      :default_url => "/assets/default_:style.png" }.merge(PAPERCLIP_STORAGE_OPTIONS)
like image 892
Mohit Jain Avatar asked Jan 01 '26 02:01

Mohit Jain


1 Answers

Simply add -interlace Line in the convert_options of your choice.

Doc states explicitly:

Use Line or Plane to create an interlaced PNG or GIF or progressive JPEG image.

like image 115
apneadiving Avatar answered Jan 02 '26 18:01

apneadiving



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!