There are three main types of images used on the internet. There are:
- This file type is best for images which have large areas of the same color. For example logos and drawings with constant background areas.
- JPG (JPEG)
- This file type is best for images such as photographs or other smooth transition images.
- This file type is designed as a replacement for the GIF type. There is a company UniSys. By virtual of a legal gimmick they now have ownership of the GIF file type. Yep they own the gif format. They are trying to control this format in the worst possible ways. So some folks are attempting to bring forth a public domain version of a similar compression. That is PNG.
Here is a logo saved as a gif file. The size of this file is 483 bytes. Very small. This is because a gif file is compressed.
Here is the same logo saved as a jpg file. The size of this file is 2500 bytes. No where near as small. This is because a jpg compresses a file differently.
This blowup demonstrates the artifacts introduced into the logo by the jpg compression being applied to this log.
In the uncompressed logo the top line is 117 pixels of blue in a row. In a gif file these 117 bytes of data are stored in two chunks. One chunk is the index of the color and the other chunk is the repetition count. That way when a browser decompresses the image it will see two instructions something like: "Paint 117 pixels of the next color, the next color is blue." As you can see a graphic with lots of solid areas of color is ideal for gif compression.
But what if every pixel is different? Well then the size of the file just about doubles. Instead of have 117 pixels of different colors you will have 117 pairs of information. "Paint 1 pixel of next color; next color is bluish" followed by "Paint 1 pixel of next color; next color is slightly different blue" etc. You can see that this would double the file.
These kinds of gradient type files are a horror story for gif compression. But they are idea for jpg. Jpg is idea for photos and any image with smooth color transitions with thousands and millions of colors. That's because a jpg is stored is a format that basically says smooch these colors from this pixel to that pixel in a smooth fashion. Although is messes up the logo, the jpg is great for photos.