The methods and techniques used in optimizing JPG images are very different from Gif optimization because the compression algorithms of the two image formats work differently.
In short, JPG compression involves a loss of details, i.e. some color pixels are replaced by other colors. This loss is recoverable, which means that once an image is saved as a JPG, you cannot retrieve the original information. So the main issue in optimizing JPGs is in decreasing their file size as well we preserving the quality of the image.
Sponsored Links
JPG compression algorithm also does a better job of optimizing the complex parts of an image. This aspect was presently briefly in When to use JPGs and in this article we will take a look at a software that I have found very useful in optimizing JPGs.
To know more about how the file size of Gif images can be decreased, I suggest you go through the article on Optimizing Gifs [This is a four page thorough tutorial on Gif optimization]. This article also points out why images for the web need to be highly optimized.
JPEG Optimizer
JPEG Optimizer is a wonderful program available at www.xat.com. I recommend it to any serious web designer (developer) interested in slimming down the file sizes of JPG images. With other image programs such as PhotoShop, FireWorks, Paint Shop Pro etc. you specify compression over the entire image. However, with JPEG Optimizer you can apply different levels of compressions to different areas. This is excellent if your image has some areas of high detail that you want to preserve. Also, the program allows a real time check on file size. I love this feature!
Finally, you can select image areas using rectangular selections, line selections or free hand selection. The program is very simple to use and you’ll be creating those really small (sizes!) JPEGs in no time at all.
Let us now look at an example.
Image saved on PhotoShop with quality 4
14599 bytes
After using JPEG Optimizer on the above image
6041 bytes
A reduction of 8558 bytes! Almost 59% reduction.
JPGs and Greyscale
Greyscale images contain 256 shades of grey (white and black included).
It is advisable to store a black and white image as greyscale. There is always a saving of some bytes. Actually, when you scan B/W photos, you should always convert them to greyscale images.
16.7 million color image
9136 bytes
Greyscale image
8905 bytes
All standard programs allow you to change the image mode of an image to greyscale. The option will be present in the Color, Image or equivalent menu.