JPEG and GIF image formats are both compression based formats. They are the most widely used and supported image formats for web. They take an uncompressed image such as bitmapped image and compress them to a smaller file size. A lot smaller image size is moreover the result of this conversion. It may seem that one compression may result in smaller file sizes, nevertheless that is simply not the case. Now where lays the difference?
JPEG stands for Joint Photographic Experts Group. It supports 16.7 million colors. It is ideal for photographic images and high quality images. JPEG is a lossless method of compression or in common parlance, when the program that creates a GIF squashes the original image down to ensure not to lose any data. It uses an easy substitution method of compression.
GIF on the other hand, stands for Graphic Interchange Format. It supports only a maximum of 256 colors. It is the only alternative to make an image animated unless you want to use Flash. Between GIF and JPEG, only GIF allows transparency. GIF is good for images with flat expenses of color. It can be use for logos, titles, button, etc. The maximum compression of GIF depends on the amount of repetition there is in an image. A flat color can compress well to even one tenth of the original size while a complex non-competitive color will save approximately 20%.
GIF format is good at compressing images with a small number of colors with no gradations. In actual fact, most web graphics are saved in GIF by contrast when applied to JPEG, it usually results in images which are larger than their GIF counterparts and may appear corrupted.
Each image format has its own advantage. GIF may win out with the non-dithering, fewer color images while JPEG is excellent for dithered continuous tone images. An example to this is a photograph with several colors, shadows and even gradations. All these colors and shades call for the JPEG format.
JPEGs disadvantage is that it throws away parts of an image to save space. Apparently you just can