cshum / imagor

Fast, secure image processing server and Go library, using libvips
Apache License 2.0
3.44k stars 138 forks source link

support vips avif speed #463

Closed liudongmiao closed 3 months ago

liudongmiao commented 3 months ago

This PR try to add avif speed for imagor.

It's said imagor doesn't support avif speed, while similar image cdns like thumbor and imgproxy do support. In a test with wrk, imagor is faster than thumbor and imgproxy, and with a smallest Stdev.

Please note, libvips has changed to parameter from speed to effort in 2021, however, speed still works. ref 1: https://www.libvips.org/API/current/VipsForeignSave.html#vips-heifsave-buffer ref 2: https://github.com/libvips/libvips/blob/master/libvips/foreign/heifsave.c (libvips would convert effort to speed again for heif's api. :-)

BTW, heif support different speed for different codec: aom 0-9, https://github.com/strukturag/libheif/blob/master/libheif/plugins/encoder_aom.cc rav1e 0-10, https://github.com/strukturag/libheif/blob/master/libheif/plugins/encoder_rav1e.cc svt 0-13, https://github.com/strukturag/libheif/blob/master/libheif/plugins/encoder_svt.cc

cshum commented 3 months ago

Thanks for the PR! Would be great if you can test a test assertion for WithAvifSpeed at https://github.com/cshum/imagor/blob/master/vips/option_test.go

liudongmiao commented 3 months ago

Thanks for merge.

cshum commented 3 months ago

Before the next version release, this is currently available under the Docker build of develop branch:

https://github.com/cshum/imagor/pkgs/container/imagor/255863182?tag=develop

ghcr.io/cshum/imagor@sha256:cd5469eaf7541eee310e9dc9ca90490a931781673cbc8875ddea3a1fcc0e9081