hamochi
hamochi

Reputation: 47

Vips + mozjpeg vs Imagick

I'm looking for a solution to get the best jpeg compression when down scaling an image. I'm comparing Vips + Mozjpeg and Imagick (convert).

My original file (pic.jpg) is 6.5 MB.

I run:

vipsthumbnail pic.jpg --size=1920x1280 --delete -o pic-vips-q96.jpg[Q=96,optimize_coding,strip,intelace]

and I my output file is 1.7 MB

I run:

convert pic.jpg -resize 1920x1280 -quality 96 -interlace plane -strip pic-imagick-q96.jpg 

and my output file is 1.2 MB

Am I doing fair comparison here? Is Imagick that much better in compressing?

The link to the original image (from unsplash): https://images.unsplash.com/photo-1545278068-cdca78378350

I'm comparing these two libraries because they both have Go bindings, which I need in my project.

Grateful for any advice!

Upvotes: 2

Views: 2628

Answers (1)

jcupitt
jcupitt

Reputation: 11179

libvips automatically disables chroma subsampling for Q > 90, so your two compression settings are not quite the same. Try this:

$ vipsthumbnail pic.jpg --size=1920x1280 -o pic-vips-q90.jpg[Q=90,optimize_coding,strip,interlace]
$ ls -l pic-vips-q90.jpg 
-rw-r--r-- 1 john john 495764 Dec 20 17:17 pic-vips-q90.jpg
$ convert pic.jpg -resize 1920x1280 -quality 90 -interlace plane -strip pic-imagick-q90.jpg
$ ls -l pic-imagick-q90.jpg 
-rw-r--r-- 1 john john 492029 Dec 20 17:17 pic-imagick-q90.jpg

So they are very close. The remaining difference is perhaps just in the downsize algorithm -- maybe libvips is making a very slightly sharper image.

libvips will probably be using libjpeg-turbo by default. If you want to compress with mozjpeg, you'll need to build everything from source.

Upvotes: 3

Related Questions