imageJPEG (pronounced jay-peg) is a standardized image compression mechanism. JPEG stands for Joint Photographic Experts Group.
JPEG is designed for compressing either full-colour or gray-scale images of natural, real-world scenes. It works well on photographs, naturalistic artwork, and similar material; not so well on lettering, simple cartoons, or line drawings. JPEG handles only still images, but there is a related standard called MPEG for motion pictures.
JPEG is lossy, meaning that the decompressed image isn't quite the same as the one you started with. (There are lossless image compression algorithms, but JPEG achieves much greater compression than is possible with lossless methods.)
JPEG is designed to exploit known limitations of the human eye, notably the fact that small colour changes are perceived less accurately than small changes in brightness. Thus, JPEG is intended for compressing images that will be looked at by humans.
A useful property of JPEG is that the degree of lossiness can be varied by adjusting compression parameters. This means that the image maker can trade off file size against output image quality. You can make extremely small files if you don't mind poor quality; this is useful for applications such as indexing image archives. Conversely, if you aren't happy with the output quality at the default compression setting, you can jack up the quality until you are satisfied, and accept lesser compression.
A fundamental advantage of JPEG is that it stores full colour information: 24 bits/pixel (16 million colours). GIF, the other image format widely used on the net, can only store 8 bits/pixel (256 or fewer colours).
Generally speaking, JPEG is superior to GIF for storing full-colour or gray-scale images of realistic scenes; that means scanned photographs, continuous-tone artwork, and similar material. Any smooth variation in colour, such as occurs in highlighted or shaded areas, will be represented more faithfully and in less space by JPEG than by GIF.
GIF does significantly better on images with only a few distinct colours,such as line drawings and simple cartoons. Not only is GIF lossless for such images, but it often compresses them more than JPEG can. For example, large areas of pixels that are all exactly the same colour are compressed very efficiently indeed by GIF. JPEG can't squeeze such data as much as GIF does without introducing visible defects. (One implication of this is that large single-colour borders are quite cheap in GIF files, while they are best avoided in JPEG files.)