DEV Community

Cover image for Faster loading webpages with webP images

Faster loading webpages with webP images

Temitope Ayodele on November 21, 2020

Have you ever wondered why your website takes forever to load? It is probably because you are using too large images. The common image types are PN...
Collapse
 
nlxdodge profile image
NLxDoDge

"However, as awesome as this is, webP is not supported on all browsers. Firefox for instance, is still working on adding it, but Chrome and Opera fully supports webP images." - Temitope Ayodele

I want to clarify that .webp is supported in firefox, as I am using it right now. And looking at caniuse.com/?search=webp you can see that it has support. Only Edge and some older Apple OS's haven got support.

Collapse
 
temmietope profile image
Temitope Ayodele

Thanks for the addition. Older versions of Firefox browsers do not though.

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

Older versions of any browser don't support it, so...

Thread Thread
 
temmietope profile image
Temitope Ayodele

Yh true, will edit. Thanks

Collapse
 
phlash profile image
Phil Ashby

Good practical advice - thanks :)

I found this report to be informative on current website stats (for those who aren't sure if image loading or javascript are the worst offenders!):

httparchive.org/reports/page-weight

Collapse
 
kiransiluveru profile image
kirankumar

This is absolutely good!!!
One small thing here is
For converting a few images it's okay for those who want to convert the entire repository images or some N no of images they can use this package.

npmjs.com/package/webp-bulk

Thanks

Collapse
 
temmietope profile image
Temitope Ayodele

Nice input! Thanks

Collapse
 
henrihelvetica profile image
Henri Helvetica

Thanks for the article. I might not immediately file JPG2000 or JPEG XR as modern formats - as the JPG2000 is just about 20yo, and it considered for replacement as we speak w/ HTJ2K or what is called High Throughput JPEG 2000. Not even sure what is happening w/ the XR. But the webp has finally achieved full support this year in 2020. If you do want to cover modern formats, I would certainly suggest looking into adding AVIF to your list. This is pretty much the buzz worthy format right now (caniuse.com/avif) and is supported by Chrome, Opera + behind a 🚩 in Firefox. There's a great tool I would also suggest playing with called Sqoosh! App (squoosh.app). Created by a team of Google engineers. Lastly, if much of this interests you, just released some videos specifically on this topic, you may enjoy. bit.ly/image_ready_videos

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

The component idea is a great one, and has a direct equivalent in ASPNET Core with tag helpers / Razor components. You could even combine it with the source set concept to deliver images at various sizes as well as formats, so browsers not WebP savvy still display the content. Thanks for sharing!

Collapse
 
martinburr profile image
Martin Burr

thank you for this article! i will include this in my future work 👍🏻

Collapse
 
programmerbyday profile image
Arman @programmerByDay

Quite thorough and practical. Cheers.

Collapse
 
iamwebwiz profile image
Ezekiel Oladejo

Nice. I especially love the idea of the component. Thanks for this! 👍

Collapse
 
vishnuharidas profile image
Vishnu Haridas • Edited

Extra care when using WebP on Apple devices. On a recent project, Safari on iOS didn't show WebP files, so we had to convert them into JPEG to be used on Safari on iOS.

Collapse
 
henrihelvetica profile image
Henri Helvetica

webp was provided support in*Safari w/ Big Sur or iOS14. So, it would be wise to still use another fall back (which ever you need) for the next few.

Collapse
 
feralamillo profile image
Feralamillo

Great article! Very practical and useful