John Cupitt
John Cupitt
Huh weird. Thanks for reporting this!
Hi @WeisiminPeng-Simmi, `vipsthumbnail` has a longer startup time, and that hurts for small images. If you process many images at once, you can see the per-image cost: ``` $ for...
> I actually use pyvips to run Libvips. Is there a way I can decrease the time using pyvips? You can use `multiprocessing` to run many resizes at once. It...
`vipsthumbnail` calls `vips_init()` to start libvips up. This does quite a few things to get ready. You can see the cost like this: ``` $ time vipsthumbnail real 0m0.032s user...
You can use multiprocessing like this: ```python #!/usr/bin/python3 import sys import pyvips from multiprocessing import Pool def thumbnail(params): filename, N = params try: # 58s thumb = pyvips.Image.thumbnail(filename, 1600) thumb.write_to_file(f"t-{N}-1600.jpg")...
You can use any number of cores you like, it was just an example.
I think we're done, I'll close.
I just noticed, you pasted this pyvips code: ```python def perform_resize(image, width, height): return image.thumbnail_image(width, height=height, size="force") ``` Don't use `thumbnail_image`! It's usually much slower than `thumbnail`. For example: ```...
You can set the env var `VIPS_CONCURRENCY` to set the threadpool size. Though libvips will automatically size down threadpools if the host machine becomes overloaded (ie. `VIPS_CONCURRENCY` really sets the...
That's true, just on import. It's a single per-process setting. You can also set `concurrency` on an image, then downstream processing on that image will use that setting. The adaptive...