Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't use thumnail_image #2

Open
jcupitt opened this issue Feb 25, 2023 · 0 comments
Open

don't use thumnail_image #2

jcupitt opened this issue Feb 25, 2023 · 0 comments

Comments

@jcupitt
Copy link

jcupitt commented Feb 25, 2023

Hi, I just stumbled upon this nice project.

I noticed it's using thumbnail_image:

https://github.com/zRedShift/thumbnailer/blob/master/vips.c#L59

This is very slow --- it's much better to use thumbnail or thumbnail_buffer, if possible. For example:

$ vipsheader theo.jpg
theo.jpg: 6048x4032 uchar, 3 bands, srgb, jpegload
$ time vips thumbnail theo.jpg x.jpg 256

real	0m0.102s
user	0m0.084s
sys	0m0.034s
$ time vips thumbnail_image theo.jpg x.jpg 256

real	0m1.697s
user	0m3.819s
sys	0m0.109s

So for a 6k x 4k pixel JPEG, thumbnail is around 15x faster.

Combining open and resize in one operation lets libvips exploit a range of tricks with resize options in the load library. You'll get better quality for things like PDF as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant