Optimizing Images for a Faster Website
May 5th, 2010 by
The way you handle images in your website can have a substantial effect on your site performance.
There are several actions you can take to make sure images are optimized and load as quickly as possible:
Compress images using Smush.it
One of the best image optimization tools available is Smush.it by Yahoo.
It lets you reduce image size without any significant quality loss.
To work with smush.it you first need to install yslow addon for Firefox and navigate to the page that contains the new images. Then:
- In Firebug panel, click on yslow tab and then go to Tools tab.
- Click on All Smush.it.

In Smush.it results tab:
- Click to download all compressed images.
- Go over the images to see which one has a high percentage of savings and click on the image name to download it.
or

Detect image dimensions with Google Page Speed
Google Page Speed extension for Firefox is a bit different from yslow and has many useful tests integrated.
Besides optimizing image size in KBs, there are 2 more important tests to do in order to increase image rendition speed (by browsers):
- In Firebug panel, click on Page Speed tab.
- Specify image dimensions: it is important to specify Width and Height attributes for every image you add to your webpage. Otherwise the browser is forced to calculate these attributes for the image and this of course wastes time.
- Serve scaled images: detects whether there are any images for which you have set height or width that are different from the image real dimensions. For example, an image that is originally 100px*100px can be displayed smaller or larger, by setting different HTML or CSS height and width.
This is not recommended because, for starters, scaled images always seem to have lower quality comparing to non scaled images. Secondly, when forcing an image that is originally 100*100 to be 50*50 by HTML/CSS, you send redundant KB that could have been saved.
The only case in which you should scale an image, is when displaying the same image several times in various dimensions in the same page.
For example, if you want to display an icon in various sizes in the same page (large-100px*100px, medium-50px*50px and small 30px*30px), you should add the 100px image and then scale it for the smaller versions.

Two more image related tips
- Use CSS sprites when possible: do not use images for layout backgrounds, site wide icons and menus. Check out this post to read more about when CSS sprites should be used instead of images.
- Store images externally: websites and blogs that have mass traffic and plenty of photos (such as webdesignerdepot) use CDN to store their images. Others use image hosting servers such as imageshack and photobucket.
If your site is hosted on shared hosting, the probability for bottlenecks is already high. Therefore, storing images in another server will ease up on the bandwidth load (of your main hosting), and will help your site load faster.
Do you optimize your images? Which tool do you use for image compression?
Additional resources
- 8 Excellent Tools for Optimizing Your Images
- Best Practices for Speeding Up Your Web Site
- Using Yahoo’s Smush It service to optimize images in WordPress

Great post and thanks very kindly for the link back to my own site regarding using the WordPress Smush-It plugin.
You’re welcome, Rob. I linked to your article because I think it is useful.
Omer, this is great stuff. Please tell me they have an extension for Chrome that does the same thing!!
Thanks for the info.
@Ileane
Ileane, I didn’t find a smush.it extension for Chrome but you can but you can use it manually here http://bit.ly/tRyRq
Page Speed obviously works with Chrome since they are both from Google
Omer, great tips. I try an optimize my images, but I never thought of storing my images offsite. I had always though storing them on the web host was the fastest way.
Currently my site is shared but eventually I will be moving it to something faster in the near future. When I am posting a bunch of pictures I normally store them on flikr or on Windows Live Imaage storage. Does those sites help speed up image download times or should I be hosting them on the sites you mentioned instead?
Also is this still important for small images and generally for just one or two images per post.
James, if you have small images or a small amount I wouldn’t worry about storing them externally.
However, storing larger amounts in flickr is a good idea (should be the same as the other image storing options).
Ultimately, the best option is storing images on CDN (such as Amazon CloudFront) so you don’t only split bandwidth between servers, but also provide the images in less time due to server proximity to the client.
I stumbled upon Smush-It the other day as I was roaming the web and I thought to myself: “Self, you’ll have to come back and check this out later…” and of course I forgot all about it. Then bang, here’s your great article, the perfect reminder. Maybe the Internet Fairies are trying to tell me something. Thanks for the nudge!
Thanks for the awesome comment, Joella
great post, i am testing the tool now.
is there any difference than compressing in PS and using smush.it ?
I always save images for web (usually in JPG quality 70) using Photoshop. But even after that compression, smush.it can make the file even smaller.
Oh, I always use Photoshop to optimize images before uploading them and think that they can’t be compressed more.
Thanks for the tool, I will try it and compare the speed.
Great tips Omar. I’ve never heard of Smush.it but now I know. I personally like to use ACDsee as it is rather convenient to batch process pictures and downsize or convert them. But it’s always good to hear of another tool. Thank you
You’re welcome, Aldric. Smush.it lets you perform batch compression as well
A great tip.
I just tried it and must say it worked very well. Some pictures have been reduced to 35% of the size. While I make some Photoshop do very small.
Yeah, smush.it really squeezes the images to the minimum size.
Hey, great tips. I shall test them all with my blog’s images. Thanks.
You’re welcome, Guilherme. I’m glad you find these tips helpful
I have just read your post at blogengage. Yes there are some tool by which we can increase our site speed. After all it is going very important for getting google SERP rank.
That tip is very helpful but if you are using wordpress then it will be damn to simple and automatic.
Just install WP-smushit plugin and it will automatically compress the images through smush.it API whenever you upload a new image file.
@chandan – thanks for commenting and welcome to WTW.
@Typhoon – thanks for the tip. You are right about the plugin if the website is WordPress based, however, I intended my yslow tip here to other websites as well.
Image sprites are still a mystery to me.
Thanks for the tip. This works well.
much appreciated for the tip, it works great!
Very well written post. It will be beneficial to everyone who employess it, including myself. Keep up the good work – i will definitely read more posts.
Hi
I tried opening the how to use firebug post but its not opening. Can you please give an introduction on firebug and how to use it. I installed the extension on firefox but I don’t think that is all there to firebug.