getkirby / ideas

This is the backlog of ideas and feature requests from the last two years. Use our new feedback platform to post your new ideas or vote on existing ideas.
https://feedback.getkirby.com
20 stars 0 forks source link

WebP generation #224

Open S1SYPHOS opened 5 years ago

S1SYPHOS commented 5 years ago

Hello there, I'd love to see WebP generation as part of Kirby's core; maybe alongside PNG / JPG generation in media folder?

WebP is a method of lossy and lossless compression that can be used on a large variety of photographic, translucent and graphical images found on the web. The degree of lossy compression is adjustable so a user can choose the trade-off between file size and image quality. WebP typically achieves an average of 30% more compression than JPEG and JPEG 2000, without loss of image quality (see Comparative Study).

Google Developers

Current browser support for WebP images is somewhat decent (Chrome, Opera & most mobile browsers, and since 01/2019: Firefox!), globally just about 80%.

For GD / Imagick, there's a PHP lib which I co-authored a while ago that might be a good starting point: https://github.com/rosell-dk/webp-convert

Anyway, thanks for listening .. and making Kirby.

bastianallgeier commented 5 years ago

Our GD lib implementation already supports webp as a source. You can toss webp images in your content folder and the thumbnails should be created correctly. I believe imagemagick can handle them as well, but I haven't tested that.

It would indeed be cool though to offer a conversion option for thumbs.

bnomei commented 5 years ago

@bastianallgeier it seems the webp mime is not part of the defaults for $page->images() collection. please make it a first class image citizen there as well.

S1SYPHOS commented 5 years ago

first class image citizen

I'm loving it :hamburger:

bvdputte commented 5 years ago

Tl;dr: Progressive jpegs are almost always better then webp, even though they are "larger".

The longer explication why: I went to perfnow()-conference, and saw a really interesting talk from Kornel Lesiński about "perceived performance" with images. Full video here: https://www.youtube.com/watch?v=jTXhYj2aCDU

S1SYPHOS commented 5 years ago

Thanks for the video! Bit off-topic, but I especially like the interviewer at the end, nodding constantly like one of these nodding head figurines.

Anyhow, I'm still intrigued by offering WebP conversion for thumbnails, though not being enabled by default. Also, it seems to me that Chrome ('Hello Google') loads WebP progressively by default, and since most people these days are using it as default browser (and will continue to do so, I'm afraid), this is still a viable option - Google will improve WebP along with Chrome for better (perceived) performance. This alliance is what makes it an even more interesting choice!

HashandSalt commented 4 years ago

The problem is that Safari does not work with WebP at all, which puts alot of ios devices out of the picture. You still need a Jpeg fallback today.

However, i did just release a WebP plugin for K3 that converts uploaded files but keeps the source file ... https://github.com/HashandSalt/kirby3-webp

lastloop commented 4 years ago

The problem is that Safari does not work with WebP at all, which puts alot of ios devices out of the picture. You still need a Jpeg fallback today.

Apple has added support for WebP images in the upcoming versions of Safari that will ship with iOS 14 & macOS 11.

S1SYPHOS commented 4 years ago

WebP would only ever need to be created alongside normal thumbnails IMHO, and .htaccess taking over the rest, that way you get the fallback AND serve WebP to suitable browsers. What do you think, @HashandSalt? Then again, you'd loose ppl serving full images straight from the content folder ..

findthebug commented 3 years ago

Would be great, if the core generates webp by default.