jarilehtinen


Using libvips as alternative to ImageMagick

For years, I have been using ImageMagick to resize large images into thumbnails. Few weeks ago I encountered a server issue where several convert processes took up most of the server's memory and things went haywire.

I started to look for alternatives: better performing image resizing software that does the same thing but with less processing power and/or memory consumption.

Performance testing

I found a git repository called speedtest-resize that compares various image resize algorithms.

I took few large images and converted them to 4 different sized thumbnails using fastjpeg and libvips, repeated the process 100 times and measured the time taken.

libvips is over 50% faster

I did not expect the difference to be that big, but libvips performed approximately 50-60% faster than ImageMagick - no matter what I threw at it.

Using libvips

Using libvips's vipsthumbnail command is easy:

vipsthumbnail source.jpg -s 100x100 -o output.jpg[Q=90,optimize_coding,strip]

Conclusion

If you do a lot of server-side image resizing, I recommend you give libvips a try. It's faster – a lot faster.


See also


Notes

1. optimize_coding is described as "compute optimal Huffman coding tables", whatever that means.


Jari Lehtinen – Web Developer Made in Finland – jari@feature.fi@jarilehtinen