Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Not all image compressions are alike and should be used to meet specific needs of your web page. When using images, the type of compression used is important in affecting the amount of information the browser is required to download before it begins loading the page. Using the right compression can decrease the size of the response.
We briefly covered this in Chapter 1 by comparing the response size and time using an ab benchmarking test on a small image and a large image, with the results showing that a larger image increased the response time due to its size. The general rule when using the different file types, JPEG, GIF, and PNG, is to use GIF for logos and small icons within a page, JPEGs for photographs or high-quality images, and finally PNGs for everything else. If you're already using this rule, you can take it one step further by compressing the images using a web compression tool such as Yahoo's Smush.it.