Image saving

Gif, png, jpg: which is the best format?

a simple experiment with a plain color image, a gradient image, and a photo image.

On this page:

  1. image with 25 plain colors
  2. image with 117 color gradient
  3. photo image with 11.185 colors
  4. some conclusions
  5. the general rule
  6. last shout!

Attention 1:
The png format is true color: just the image as it is painted.

Attention 2:
The png's are all without transparency.

Update 16 dec. 2006:
Tip: if a gif is covering partially the same colors of a background img behind, then you can save lots of kB's by giving transparency to the identical colors !
 

1.
Image with 25 plain colors

23 colors are painted in boxes, and a black line and a white line of 1px are placed on each row.
Summary of the result:
 

 
(in real life: the gif | the png | the jpg-1 | the jpg-25% )


Notes:

2.
Image with 117 color gradient

This time a gradient image with 117 colors in it is the starting point. A 256 color gif can easily contain them.
Summary of the result:
 


(in real life: the gif | the png | the jpg-1 | the jpg-50% )


Notes:


 

3.
Photo image with 11.185 colors

In the original of the photograph 11.185 colors can be counted. As said by Paint Shop Pro, didn't check it by hand. ;-)
Summary of the result:
 


(in real life: the gif | the png | the jpg-25% | the jpg-50% | extra: jpg-1 )


Notes:

Enlargement of the tower part:
 


Notes:

In this case, I should choose the 25% jpg: it has a reasonable quality and is small too.


While this is only a 150x110px image, the difference in kB's between the saving formats is not so much.

But when there are a lot of small images, or a bigger one in a web page, the difference can increase or decrease the download speed dramatically.
Compare a 720x480px image:

[to aid in quality comparison, the images will open in a new window.]

 

4.
Some conclusions

 

5.
The general rule

As the conclusions show:

the general rule is: there is no general rule!

It depends strongly on the characteristics of the used image what saving technique for web publication is the best.

The best you can do, is:


In this way you are assured to get the most fitting image for your needs, as well as the greatest usability (highest download speed) for the visitor.

And in case of big images:


Also it can be a good idea to experiment with the available types of saving in your painting program:

 

6.
Last shout!

The visitors of your site will appreciate your site a lot more when they get quick and good images on screen.
And for you as web maker: the 5 minutes needed to save an image in different ways are not the pain!


francky kleyneman21 apr. 2006


More topics / testpages about images in this site:
Semi transparent png's (with IE-png hack)
Semi-tranparent dropshadow in css (without IE-png hack)

Testpage png-like gif (with a little help of friend css)
The port-hole theory (positioning of background-images in css)
 

 

This article was triggered by lots of images I saw on the www,
and by questions asking for "Site check please" in the css discuss list.

 

Valid HTML 4.01 Transitional

Valid CSS

mail francky?
mail francky!