JPEG
Developed
for use with photographic and continuous tone imagery. Do not use for
flat-colour or line-work graphics.
Advantages
- Huge
compression ratios are possible, for faster download speeds.
- Gives
excellent results in most photographs.
- Supports
full-color images (24-bit "true color" images).
How
it works
The JPEG
format compresses images by accurately recording the brightness of each
pixel but averaging out the hues, which our eyes distinguish less accurately.
In effect, it records a description of an image, not the literal composition
of that image. The viewer's Web browser or graphics application decodes
this description into a bitmap that looks more or less like the original
image. The accuracy of the reconstructed image depends on how much compression
is applied. The decoded hues are rendered in sample blocks with diffused
shapes. Since these blocks tend to overlap, it's very difficult--and
takes a lot of data--to produce a distinct boundary between colors.
But this technique works very well for photographic images with gradual
color changes and no sharp edges.
Warning
If you
open a JPEG and modify it, you're modifying the interpreted bitmap rather
than the JPEG data itself. Resaving as a JPEG will put the interpreted
bitmap, defects and all, back through the encoding process, and the
resulting image will be further degraded. Never resave a JPEG if you
don't have to.
JPEG
Image Artifacts
The JPEG
algorithm was optimized for compressing conventional pictorial photographs,
and is also very good at handling complex realistic illustrations (which
look like photographs). Photos and art with smooth color and tonal transitions,
and few areas of harsh contrast or sharp edges are ideal for JPEG compression.
However, most page design elements, diagrams, the typography within
images, and many illustrations are composed of hard-edged graphics and
bright colors that are seldom encountered in photographs (part a; b
is a magnification of the diagram). JPEG compression can be quite poor
at handling many computer-generated graphics, buttons, type in images,
or any other hard-edged "artificial" colored object seen in artwork
or diagrams. When compressed with JPEG, diagrammatic images show a "noise"
pattern of compression garbage around the transition areas (c, below)
the JPEG algorithm "wants" to see smooth tonal transitions and cannot
properly reproduce the harsh transitions at the edges of diagrammatic
graphics.