Outside the Cube (8817)
Web publishing (65)
about DelphiFAQ (14)
perl CGI (3)
Web Hosting (8)
Saving images as PNG or GIF?
2 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question:Should I save our web site's images as .PNG or as .GIF images?
Answer:In the far past, GIF was the standard for non-photographic images while JPEG was for photographic images. The reason is that GIF only allows 256 colors and its compression algorithm is more suited for computer drawings such as buttons, lines etc. The JPEG algorithm is very bad at such graphics e.g. it will have a big quality problem with compressing an image that consists of a thin black line on white ground. GIF would be ideal for that. JPEG on the other hand is ideal for compressing a photo of a sunset with no visible loss. (It does lose many pixels' exact color information but not visible to the human eye.)
After GIF had become a standard, the US based company Unisys remembered that they had a patent on the LZW compression algorithm which is used in GIF. They charged a fee for any application that could read or write GIF images. Note: The Unisys LZW patent expired in the USA on June 20, 2003. It also expired in Canada, France, Italy, Germany, the United Kingdom, and Japan.
For that reason in 1995 an alternative for GIF was created: PNG.
PNG is like GIF lossless, meaning very suitable for computer graphics. It compresses better than GIF though, in almost all cases. PNG also allows more than 256 colors plus it allows variable transparency (alpha channel). PNG allows to store correction factors for brightness (gamma factor) and color hue (GIF does not).
When PNG came out, it was questionable if it was going to be successful simply because GIF images were everywhere and supported by all software (even though the publisher had to pay a fee to Unisys then, even if it was freeware).
However, since ~ 2000, all browsers support PNG, meanwhile even the dreaded Internet Explorer does it error-free.
Therefore I recommend using PNG images for new projects.
Visit http://www.libpng.org/pub/png/pngstatus.html to see about the status of PNG support and development.