Using libvips as an alternative to ImageMagick
November 11th, 2017
I have been using ImageMagick to resize large images into thumbnails as long as I remember.
Few weeks ago I encountered a server issue where several convert processes consumed most of the server's memory and things went haywire.
I started to look for alternatives: better performing image resizing software which consumes less processing power and memory.
I found a repository called speedtest-resize which compares various image resize algorithms.
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. If you do some other adjustments besides resizing, you might lose some features over ImageMagick.
Using libvips's vipsthumbnail command is easy:
vipsthumbnail source.jpg -s 100x100 -o output.jpg[Q=90,optimize_coding,strip]
- -s [width]x[height] Output image target width and height
- -o path Output image file path
- Q=n Image quality/compression (n = 1-100, default 75)
- optimize_coding Turns on the libjpeg's coding optimizer
- strip Strips all the metadata from the image
If you do a lot of server-side image resizing, I recommend you give libvips a try. It's faster – a lot faster.