Last Updated: March 08, 2017
· ninjabiscuit

Use ImageMagick to create optimised and progressive JPGs

Use the following command to optimise a JPG and make it progressive:

convert -strip -interlace Plane -quality 80 input-file.jpg output-file.jpg 

Batch all the images in a folder like this:

for i in source/images/backgrounds/*.jpg; do convert -strip -interlace Plane -quality 80 $i $i; done  

With Carrierwave and MiniMagick you can create an optimise function like this:

def optimize
  manipulate! do |img|
      return img unless img.mime_type.match /image\/jpeg/
      img.combine_options do |c|
          c.quality "80"
          c.depth "8"
          c.interlace "plane"

And use it in your uploader like this:

version :large do
  process :optimize

4 Responses
Add your response

I didn't know about -interlace, thanks for sharing :-)

over 1 year ago ·

Progressive JPEG doesn't work for me with MiniMagick 4.0.4.
Searching in the doc for an interlace method found no result:

over 1 year ago ·

@caedes MiniMagic uses ImageMagics command line program mogrify which has an interlace feature (

Full list of supported mogrify commands can be found here:

over 1 year ago ·

I wanna convert all images, including png, jpg, gif to progressive jpg and used this method, I got a new version of images, but the extension of file is not changed. For example, input.png only output progressive_input.png.

over 1 year ago ·