When to Use JPEGs

As mentioned earlier, JPEGs, with their 24-bit color capacity and specialized compression scheme are ideal for photographic and other continuous-tone images, such as paintings, watercolor illustrations, and grayscale images with the 256 shades of gray.

JPEGs are notably not good at compressing graphical images with areas of solid color, such as logos, line art, type, and cartoon-like illustrations. JPEG’s lossy compression makes flat colors blotchy and pixilated, resulting in unacceptable loss of quality in some cases. Not only that, the files will generally be quite a bit larger than a GIF file of the same image. JPEG compression is also not good at sharp edges or typography since it tends to leave artifacts that “ripple” the edges.

It is generally best to let JPEGs handle photographic material and to leave the graphics to GIF.

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.