I had a go at adding support for WebP as an output format for resize_image.
I was about to create a pull request for the code, and was told to post here first to ask if anyone else thought this was a good idea, so here I go
WebP is a new image format, that is developed by google. It can do lossy and lossless, you can read more by googling it (as I am not allowed to put more than 2 links in this post because I am a new user).
I used the webp crate to do the actual encoding, and everything seems to be working fine. The only “problem” i see is that when you select the format “auto” Zola will look at the file extension of the source image (that is to be resized) and guess if it is lossy, that is not really something you can do with WebP, since it can be both. The outcome will be that a lossy WebP image can be encoded into a lossless png, but that is only a problem if you take a WebP as source and select auto, so not really related to my pull request.
You can see the code changes required here:
I have tested it out on my out Zola page, it only has 22 image but here are my size numbers:
png 2.62 MB
webp lossless 1,65 MB
jpg (quality 50) 0,44 MB
webp (quality 50) 0,10 MB
So what are peoples thoughts, is this a good feature for Zola?