We’ve spoken at length about minimizing load time for faster user experiences and why it’s important to do so, and today I’m going to shed some light on how to optimize images in Photoshop for better web performance.
Keeping image size to a minimum is an important part of keeping your sites visual weight low. By understanding a bit about image compression, and how to optimize images for web, it’s possible to significantly cut down on image size while improving image quality.
Save For Web and Devices in Photoshop
The first key to better image optimization is adjusting choosing how you save images for the web from Photoshop. If you’re used to the typical “Save” or “Save As…” functions, it’s time to learn a new trick:
“File > Save for Web & Devices…” is what you should start using when saving images for the web. Working from this tool gives extra you much more control over image control, with previews of how an image will look after compressed. There are even fine tuning controls for advanced users.
There are three formats we’ll be discussing in this article, and they are the three you’ll find yourself most commonly using:
- .jpg – Lossy Format, great for photographs
- .png (8-bit) – Lossless Compression type, limited color range
- .gif – Lossless with limited color range like .png 8, but .png is usually the better choice.
There will be instances when you’ll need to use 24-bit .png (ie: it’s the only commonly supported filetype with an alpha channel for image transparency on the web), but for the purposes of this artice we will not be discussing it. It will almost always be larger than any other format given that it’s a lossless compression type that supports a wider color range.
The .jpg image format is best suited for images that have a wide range of colors where there aren’t sharp transitions or fine edges. Because of it’s compression algorithm, it works very well for Photographs. It’s possible to significantly reduce the file sizes of photographs using JPG while keeping image quality very high. Take the image below for example: There is hardly any percievable difference between the image saved at maximum quality (a close representation to the original image) and the .jpg saved at “High” (or 60%) quality. Even so, the image is nearly 1/4th the original size!
With .jpg compression you have the ability to pretty freely adjust the quality in exchange for file size. With photographs, you’ll probably find 60-70% quality to work just fine. If there is text in the image, you may notice more artifacts given the sharp edges, and may have to bump up the quality.
.gif and .png Compression
The .gif and 8-bit .png image formats are better suited for images with limited color ranges (they can display up to 256 colors), where there are large areas of uniform color. In these instances, .png and .gif will usually produce a close-to-perfect representation of the original image while saving at a higher rate than .jpg. Typical uses of these formats include interface items, icons, and images where text needs to be represented accurately.
More often than not, the 8-bit .png format will compress better than .gif. Both formats support transparent pixels (Not to be confused with alpha transparency which is supported by 24-bit .png).
Image File Size really Adds Up
Compressing one image might cut down a little on overall page size, but if you make it a common practice to optimize images all around your website, you’ll end up saving heaps of bandwidth serving smaller files. By serving smaller files, you can make pages load faster, and make the user experience feel much more snappy.
Page load time is a huge factor in retaining users. In one recent online poll, 51% indicated that slow load times were the number one element that drove them away from a web page. Optimizing images isn’t the only way to speed up your website, but it’s a great way to start.
The .DESIGN domain is the mark of a proud member of the design community as well as an opportunity to make your web address as personal as your aesthetic. First impressions have never been so powerful.