webp-sh / webp_server_go

Go version of WebP Server. A tool that will serve your JPG/PNG/BMP/SVGs as WebP/AVIF format with compression, on-the-fly.
https://docs.webp.sh
GNU General Public License v3.0
1.79k stars 174 forks source link

A problem converting GIF images to AVIF format #301

Closed MIKU-N closed 9 months ago

MIKU-N commented 9 months ago

Describe the bug I found that webp_server_go can compress GIF images to Webp/AVIF, but the converted AVIF images do not seem to play properly

preview image: https://img.nekovo.dev/piclist/upload/202311061013694.gif

docker logs image

n0vad3v commented 9 months ago

Thanks for reporting, this is a known issue that AVIF image converted from GIF will be static(WebP should not be affected), currently you can turn off AVIF conversion to mitigate this problem.

We're planning to update docs for this, and add some patch on WebP Server Go.

n0vad3v commented 9 months ago

We've released version 0.10.3 that should fix this problem: https://github.com/webp-sh/webp_server_go/releases/tag/0.10.3

MIKU-N commented 9 months ago

We've released version 0.10.3 that should fix this problem: https://github.com/webp-sh/webp_server_go/releases/tag/0.10.3

Now GIF was ignore ,but it seems that the program is still trying to provide AVIF images, and will not switch to providing compressed Webp images. image

n0vad3v commented 9 months ago

The warning msg="xxxx.avif" not found on filesystem is just a notice that it tries to find if there is an AVIF image and is smaller in size(even AVIF is not enabled in config). It's completely normal, as long as the WebP Server Go is serving WebP or GIF images to your browser.

MIKU-N commented 9 months ago

The warning msg="xxxx.avif" not found on filesystem is just a notice that it tries to find if there is an AVIF image and is smaller in size(even AVIF is not enabled in config). It's completely normal, as long as the WebP Server Go is serving WebP or GIF images to your browser.

OK,This problem was fixed. But I see sometimes the compressed image is larger than the one before compression,why it happen?

n0vad3v commented 9 months ago

The warning msg="xxxx.avif" not found on filesystem is just a notice that it tries to find if there is an AVIF image and is smaller in size(even AVIF is not enabled in config). It's completely normal, as long as the WebP Server Go is serving WebP or GIF images to your browser.

OK,This problem was fixed. But I see sometimes the compressed image is larger than the one before compression,why it happen?

That's entirely normal at all, sometimes the encoded version(whatever WebP or AVIF) might be bigger than the original image, in this case WebP Server Go will render the smallest file to visitor.

The deeper reason for this might be related to underlying encoding algorithm.