JPEG compression is a "loss-y" compression scheme; this means that actual image data is lost in the compression process, and that the final JPEG image is only an approximation of the original image. Having said this, extremely high-quality JPEGs can be virtually indistinguishable from original source files, although the final file sizes in very high-quality JPEGs can be quite large. The harder you compress an image using JPEG compression, the smaller your final file size will be, but the more your image quality will suffer. Conversely, the less you compress an image using JPEG compression, the larger your final file size will be, and the better your image quality.
JPEG compression uses full 24-bit color to create its images, which means that you can retain the entire rainbow of RGB millions-of-colors when creating JPEGs. Unlike GIFs, you do not index JPEGs to a reduced color palette; instead you retain full 24-bit RGB color while compressing your images.
JPEG compression reduces final image file size by only sampling some pre-determined percentage of the total pixels in the picture; sampling is done in inverse proportion to the intensity of compression. The harder you compress an image using JPEG compression, the fewer pixels you sample and the greater the loss of image integrity; the less you compress an image, then, the more pixels you sample and the better the final JPEG image quality.
Here is an example of the same photograph subjected to different levels of JPEG compression.
When JPEGs are reassembled by a browser or other application for display, an approximation of the colors which should be surrounding each pixel are made, based on the neighboring sampled pixels (which are sampled, I believe, in a hexagonal pattern). This reconstruction of the original image can be very obvious on highly compressed JPEGs, leaving hexagonal artifacts, blotchy colors, and overall low image quality. On the other hand, with high-quality, less-compressed JPEGs, this image reconstruction is virtually undetectable, leaving only a beautiful photograph.
The amount of JPEG compression you want to apply to an image will vary from photograph to photograph, and is an aesthetic judgement based on overall file size restrictions for the site, the number of JPEGs and other graphics you want to display simultaneously, and a host of other considerations. When creating JPEGs for the Web, some compromise will have to be reached between perfect image fidelity and a small file size. You will end up having to sacrifice some degree of image quality, but how much to sacrifice will depend entirely on the purpose you intend for the final image. Are you mounting a portfolio of your paintings on the Web? You will need very high-quality JPEGs for that purpose, which means that you should never ask a user to download more than one at a time as the file size for each image will be quite large. On the other hand, if you are creating abstract cloud-images, photographs of fog, or mushy pictures without much detail for backgrounds or sidebars, you can get away with much higher compression before image quality deteriorates appreciably.
The rule of thumb to follow is that the more detail you need to recognize in the picture, the less you can compress the image.
JPEG compression, by its very nature, is not appropriate for graphics with sharp edges, like text, since JPEG compression only approximates the original image when displayed. If you have a photograph which has text or flow-chart lines or fine detail plastered across it, you may be forced to use GIF compression rather than JPEG compression, even though the final image size and color quality may suffer.
Creating a JPEG using Adobe Photoshop 5.5 and better involves the FILE menu's SAVE FOR WEB feature. Once you bring up the "Save For Web" screen (as you can see in the screen shot below), you set the image-type pulldown to JPEG, and either of the two quality settings below it to the preferred choice (these pulldowns are linked). Do NOT check "Optimized" or "Progressive", as these forms of JPEG are not universally understood.
Copyright © 2001 Michael Masumoto. All Rights Reserved.