vips-ffm icon indicating copy to clipboard operation
vips-ffm copied to clipboard

avoid `thumbnailImage`

Open jcupitt opened this issue 1 month ago • 0 comments

I noticed some of the sample code uses thumbnailImage, eg.:

https://github.com/lopcode/vips-ffm/blob/main/sample/src/main/kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt#L32

The libvips thumbnail_image operation can be slow and is only there for emergencies. It's much better to use thumbnail, if possible. For example:

$ time vips thumbnail_image nina.jpg x.jpg 128
real	0m0.126s
user	0m0.079s
sys	0m0.049s

$ time vips thumbnail nina.jpg x.jpg 128
real	0m0.062s
user	0m0.043s
sys	0m0.020s

Because thumbnail combines open and load into a single operation, it can do tricks with many file formats to improve load time and quality.

jcupitt avatar Nov 17 '25 11:11 jcupitt