Will Resizing images in HTML optimize and increase speed of page-loading? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Will Resizing images in HTML optimize and increase speed of page-loading?

Hello! NOTE (HTML\ course\ images): Large image may cause in slow page loading. I want to know if we had for example an image 1920px * 1080px with 2MB size and then used: <img src="img.jpg" height="500px" width="600px" alt=""/> Does web browser or etc compress our image and result in improved, optimized and faster page loading?! Or resizing has no effect neither image's 2MB size nor faster page loading and that NOTE just stands on we have to care about choosing image size?! Thanks all.

12th May 2018, 2:27 PM
xXx
xXx - avatar
3 Answers
+ 7
Unfortunately nope. In fact, the browser need to perform the resize on-the-fly to ensure the image displaying correctly in the container and thus cost more overhead. Besides, it may generate some artifacts in the image due to the resizing algorithm if the scale factor is too large. Bonus: You may be interested with the term "Progressive JPEG". Go ahead and Google it! 😉
12th May 2018, 3:17 PM
Zephyr Koo
Zephyr Koo - avatar
+ 6
You're welcome! 😉
12th May 2018, 7:03 PM
Zephyr Koo
Zephyr Koo - avatar
+ 3
Thanks Zephyr Koo. Sure why not?! :D
12th May 2018, 4:00 PM
xXx
xXx - avatar