Creating .webp and .jpg images with imagemagick

Hi everyone,

I’m trying to create two images a .webp and a .jpg everytime a thumb is created by Kirby.
Afterwards I want to use a few htaccess lines to detect if the browser supports webp images and then replace all jpg images with webp.

What would be a good approach to do this?

I think of something like “splitting” the IM thumb driver. One with all the jpg options and commands and one for webp. Maybe someone already achieved it?

1 Like

I also want .webp images!

So i am bumping this up!

@fabianmichael said once adding webp to kirby might be difficult.
imageset plugin could create picuture element with different srcsets for each file with a custom snippet (no htacess needed then).

Here is a link with some criticism regarding webp

Edit: This post has been edited by moderator. I think I leave the link here in case anyone is interested instead of removing the complete post.

[added two days later:]
If you look at Can I use .webp, you see, that this file type is not supported by some browsers:

That is another point, why I would not use this file type.


maybe that mozjpeg is still smaller and has better visual quality than webp? :wink:

Btw with mozjpeg vs webp its not actually the only issue. This will have to eventualy be tackled somehow.
Webp might suck now but it will only get better as it ages. Mozjpeg is on limits of jpeg. Webp is also much better alternative to animated gifs.

And most importantly there are things like BPG coming into browsers. Which might blow all of the rest away. So there will be time (i think very soon) where your clients will have jpegs but you will need to serve something different.

1 Like