Know when to use the JPG compression algorithm on images such as photographs so that they result in optimized web images.
when to use jpgs, high color and jpgs, jpg compression, jpgs and color gradients, jpgs and photographs

When to use jpgs

JPGs are suited for photographs or other high color images because of the following reasons

  • Photographs are high color images and this is what is needed to compress the images using the JPG algorithm.
  • Gradients and subtle colors changes are a common feature of photographs. Also, color gradients contain pixels of several colors and this is what is required by the JPG compression algorithm. (refer above point)
  • JPG allows various levels of compression. This helps you choose the correct one for the image in question.
  • Even high JPG compression on photographs is not very perceptible.

Original JPG

Original JPG (3838 bytes). Consider this 100%
Compressed Jpg: 82% of the original

82% of the original (3184 bytes)
Compressed Jpg: 60% of the original

60% of the original (2310 bytes)
Compressed Jpg: 51% of the original

51% of the original (1981 bytes)
Note that pixelation starts to appear at the 'crown' since this section of the image contain sharp edges.

Compressed Jpg: 40% of the original

40% of the original (1569 bytes)
Compressed Jpg: 20% of the original

20% of the original (783 bytes)

For details on why GIF format should not be used for photographs, refer the section on When to use gifs.

When to avoid JPGs

The JPG algorithm does not do justice to images with sharp edges such as text, cartoons, line-art etc. You should choose the GIF file format for such images. For further details, refer When to use gifs. For further details, refer When to use Gifs and JPGs and Using JPG and Gif in a single image.

Also, JPG does not support color transparency and animation. You might have to use the GIF format if you want these features.
I have a interesting tip on how to make animated JPGs using a little JavaScript. You can find the details here.


AddThis Social Bookmark Button
Page contents: JPG compression algorithm tutorial: JPGs are suited best and should be used for photographs and other high color images.

Page URL: http://www.webdevelopersnotes.com/graphics/ when_to_use_jpgs.php3



Join Mailing List


Feedback/Questions




50+ web hosting FAQs

Search engine for your website

Free software from Google - The Google Pack Collection

Create your own search engine
Search WebDevelopersNotes.com