image formats and compression
There are several kinds of images on a computer so which one do you use? They impact the image quality and file size differently because of something called "compression". In other articles I'll discuss the other issues like transparency.
In most cases the image type is chosen with the 'save as' menu item which in Windows programs is under the 'file' menu. I don't know all graphic programs so I'll leave that up to you to research and figure out.
Whenever a file is made smaller (compressed) like many file formats do something has to be thrown out. The hope is that whatever is discarded wont be noticed. The compression is called "lossy" when what is discarded is lost forever. A “lossless” compression can be reconstructed. The most common “lossy” is JPG and “lossless” is GIF so each kind of file is most appropriate in different situations.
PNG is simply an improvement on GIF that was propelled along because of the patents Unisys was threatening it with. Some of the features in a PNG rivals the quality of a JPG. The only feature in GIF you are losing with a PNG is animation. If you don't care about animation then PNG is a good choice to replace all GIF files.
When there are large areas of all one color, a lossless compression will not record the color of each and every pixel but how many pixels there are of that color. But what about situations like clouds on the sky or shadows that get darker the further in one direction the subject is? In both cases makes each pixel in the area a slightly different color even if it looks the same to the human eye. This is what makes GIF better in graphics with a flat background and JPG better with photos.
However, there is a problem with compression JPG images use that makes them degrade after a while. When JPG compresses an image it sees gradients where there aren't any. It starts converting flat colors to a gradient when an image is saved. The next time that phantom gradient becomes even more of a gradient so the color looks worse and worse each time the image is saved. White background looks an off-white and dirty in places while black letters look gray instead of black. This is common both in images with the sky and images with text. It sees clouds we can't see with our eyes as a gradient and it exaggerates it. It also adds gradient when there is a strong jump from one color to another that is very different.
You can set the amount of change a JPG finds tolerable in something called a “compression ratio”. Again, each program does it just a bit different so I'll cover only the general idea and let you figure the specifics to your image manipulation program. Basically, the more compression there is, the more details will be thrown-out and the worse the image will look. However, with a small ratio the file will still be big which may exceed the limits of a web-site or may slow-down displaying a web-page.
What a lot of people do is save the image in an uncompressed file type (depends on the program) before they edit it, and then save it to JPG at the last minute. Some programs like Microsoft's Paint use BMP image is an uncompressed image type but it has so few colors that images with a lot of colors looks bad. PNG is a good choice if you can't find an uncompressed file type because it has so many colors.
Sometimes I save an image in a couple of the formats just to see the impact on the image quality and file size but for the most part I use three rules:
1- GIF if there are a small number of colors and animation is required
2- JPG if the image is a photograph or very realistic.
3- PNG if there is more than one image laid over another.