![]() |
![]() |
![]() |
![]() |
|
libvips ships with a handy command-line image thumbnailer, vipsthumbnail
. This page introduces it, with some examples.
The thumbnailing functionality is implemented by
and vips_thumbnail()
(which thumbnails an image held as a string), see the docs for details. You can use these functions from any language with a libvips binding. For example, from PHP you could write:
vips_thumbnail_buffer()
$filename = "image.jpg"; $image = Vips\Image::thumbnail($filename, 200, ["height" => 200]); $image->writeToFile("my-thumbnail.jpg");
vipsthumbnail
supports the usual range of vips command-line options. A few of them are useful:
--vips-cache-trace
shows each operation as libvips starts it. It can be handy to see exactly what operations vipsthumbnail
is running for you.
--vips-leak
turns on the libvips memory leak checker. As well as reporting leaks (hopefully there are none) it also tracks and reports peak memory use.
--vips-progress
runs a progress indicator during computation. It can be useful to see where libvips is looping and how often.
--vips-info
shows a higher level view of the operations that vipsthumbnail
is running.