0

I compared ImageMagick with other tools. In my example I just want to resize and compress images. The goal is an acceptable file size with good quality.

Original file size: 127 Kb

Comparison between ImageMagick and Caesium

Unscaled, quality set to 80%

  • ImageMagick: convert image.jpg -strip -quality 80 optImage.jpg
    => 123 Kb
  • Casesium: 101 Kb

Scaled to 640x359, quality set to 80%

  • ImageMagick: convert image.jpg -strip -resize 640x359! -quality 80 optImage.jpg
    => 48 Kb
  • Caesium: 33.6 Kb

So what is wrong with that? Is there any ImageMagick-option I should include? Or is the quality parameter different between these tools?

EDIT: is there any Linux shell tool which is able to resize (maybe crop) and compress as good as Caesium?

Luca Nate Mahler
  • 1,292
  • 2
  • 13
  • 28

2 Answers2

0

I found out that these quality-parameters are not the same; 80% quality on ImageMagick corresponds to 87% (not exact) in Caesium; to get a acceptable file size the ImageMagick quality-parameter should set to 80 (not losless). But I think it's not bad to use an extra losless compression for ImageMagick-resized images like jpegtran for JPGs and optiPNG for PNGs. They can reduce the file size a bit more.

Luca Nate Mahler
  • 1,292
  • 2
  • 13
  • 28
0

If you have an acceptable file size in mind, you can tell ImageMagick what it is and it will do its best to honour it.

Like this:

convert image.jpg -strip -define jpeg:extent=88kb optImage.jpg

If you want a way to do something similar with Python, I wrote an answer that works pretty well here. It does a binary search for a JPEG quality that satisfies a maximum size requirement.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432