Image format comparisons
Let’s consider an example to illustrate the possible savings. In the code that accompanies this chapter, you will find a file called scones.jpg
. This is the same picture of scones we used in Chapter 1, The Essentials of Responsive Web Design, completely unmodified. On my computer, it tells me it has a file size of 199KB. If I load that file into the aforementioned Squoosh and leave the defaults, it tells me it can optimize the file down to a JPG of only 122KB. That file is in the code as squoosh-scones.jpg
. That 39% saving in itself should be enough to show how much unneeded weight our images contain.
How does image optimization work?
By default, an image from an application like Photoshop or straight out of a camera contains heaps of extra information we just don’t need when destined for the web. Things like the location the image was taken, the date and time, camera used, aperture and lens settings, focal depth, and heaps...