A few scanning tips

www.scantips.com

JPEG Artifacts

I am sent JPG images with questions why they appear "bad" and very "unclear", when the only problem is excessive JPG compression, too much, or saved too many times, or both. Too little Quality or too much Compression will affect JPG image quality visibly. It can be awful.

You can and should learn to recognize this bad effect yourself. It's easy to recognize, almost trivial, after you've seen it once. Then you will know if it is acceptable or not, and you will know that you have choices.

How to see JPG artifacts the first time

If using a digital camera, shoot the same scene as the best file format you have, a RAW or TIF file, or at least at the best JPG quality setting (largest file). Also shoot exactly the same scene at the lowest JPG quality setting (smallest file). If using a scanner, scan a new photo image and save it as a TIF file. Then, after that, also save the same image as a JPG file using more compression than usual, a lower JPG quality setting this one time to help learn to see it. Then close that JPG image, and reopen that file to be sure you are viewing the contents of the file image you actually wrote (instead of the uncompressed image on the screen that you thought you wrote).

Then examine both large and small file images side by side on the same screen, by zooming in to about 4 times size (400%, huge) on both. You will have to scroll around on them, but the 400% is to help you learn to recognize the artifacts this first time. The differences you see are the JPG artifacts of compression.

The visible signs of excessive JPG compression are JPG artifacts, which include:

Here are samples below, zoomed large, but same size and side by side for comparison, to better learn to recognize the JPG artifacts (that is a cookie jar at left, with a little reflection on it)

original TIF

Original TIF image ABOVE, zoomed to 300% size

Low Quality JPG image BELOW, zoomed to 300% size

JPG 2

Not that it seems necessary, but I have marked a few of the 8x8 pixel blocks seen in areas of similar color, and also some of the smudging around sharp edges (all edges). You can find more almost any place in the image. Notice the missing detail at the ridged knob marked in blue. The two power cords behind the fruit are nearly obscured by JPG artifacts. The tiny jaggies in the TIF are the original pixels zoomed to 300%. Their size is a guide to show the larger JPG 8x8 pixel blocks are clearly a different artifact.

Zooming to 300% size is not the normal thing to do, but it does help to recognize these JPG artifacts the first time. After you learn what you are looking for, then you can recognize them at 100% size too.

This sample shows what is meant by "lossy compression" in JPG — the losses are from deteriorating image quality due to the JPG artifacts. Using a Higher JPG Quality setting to produce a larger JPG file improves the JPG image quality. Using a Lower JPG Quality setting to produce a smaller file makes it worse. That seems straight-forward. A High JPG Quality setting of 8 or 9 (assuming a 1-10 scale, but 80 or 90 on a 1-100 scale is used by some software - same thing) is normally a pretty good image, normally not much problem for read-only uses, like viewing or printing (both zoomed images above are in a High quality JPG now for web presentation). The problem then is when you want to edit the image and save it yet again as JPG (additional JPG artifacts accumulate each time). We should only save a JPG image ONE TIME.

Note that most other types of image file compression (for example PNG or TIF LZW) are lossless compression, meaning that there is absolutely no loss of quality due to compression (zero loss), so that then file quality is simply not an issue at all, and the most critical user need not ever worry about it. The TIF file above used LZW compression. However lossless file compression is less effective, meaning that it can not produce files so drastically small as JPG. The lossless file size is closer to the actual size of the color data, perhaps 70% or 80% instead of 5% to 20%.

I want to call this JPG an extreme example, and it is poor, but it is not extreme. You ought to see some of the images that people send me asking why their images are so poor. This JPG was done in Photoshop, and Adobe's lowest quality settings are conservative, and won't let us make them as extreme and poor as some other programs will. The JPG quality numbers like 8 or 9 are NOT absolute values, instead they are relative to the JPG properties that each program chooses to individually use.

JPG artifacts do vary, and this will be of more concern when you do this same test on your own images. Once you realize what you are looking for, then JPG artifacts are easy to see and recognize at 100% size. Some people are more critical than others, asking "How good can I make it?" instead of "How small can I make it"? Your priorities are your own, but after you are able to recognize JPG artifacts, you will be able to judge how much of this you want in your own images.

Here is another older sample showing JPG artifacts.

Use a higher JPG Quality factor to minimize these effects (or don't use JPG at all if maximum quality is important). Less JPG Quality is more JPG compression, a smaller file, but worse artifacts. Normally you may detect some artifacts even at high Quality factors, and you can learn to recognize this easier if you zoom in to about 400% size. But the image can still be very usable size if the compression is mild. Now you know what to look for, and how to look for it, and how to judge if you want it or not.

The JPG artifacts become part of the image data, and it cannot be removed. Sharpening again after JPG compression (next time) will emphasize these JPG artifacts, so be careful with that. Actually, very slight intentional softening or blurring before JPG compression will help minimize the effect of the JPG artifacts (and will slightly reduce JPG file size too).

JPG normally should not be used for text or graphic images. It obscures the sharp edges too much, and the results are typically poor. TIF LZW, PNG, and GIF are vastly better for line art or graphic images, and these will normally compress text and graphics effectively. The way to make a scanned text document PDF file smaller is to scan in Line art mode and use compression. Acrobat will use G4 compression which is very small for line art, but LZW is good too. For text, line art will be smaller and better result than a JPG grayscale file. JPG cannot handle line art or indexed color anyway, JPG requires 8 bit grayscale or 24 bit color. However for continuous tone photo images, as opposed to text or graphics, then files with high JPG Quality (low compression) are normally acceptable for viewing (read-only purposes), and the small file size is extremely desirable for modems.

Due to the quality concerns, JPG compression is generally NOT suitable for archiving the important master copy of your image. With only mild compression, it might view OK, but you should grit your teeth, hold your breath, and cross your fingers for luck, if you ever have the need to modify and save a JPG file again. Because this will lower the quality of that image even more, every time you save the file. By "save", I mean to select the FILE - SAVE or FILE - SAVE AS or FILE - SAVE FOR WEB menu with JPG format from an image program. That SAVE step does the JPG compression again.

Note that downloading, or copying, or opening and viewing JPG files is no problem at all. This does not save the file again, and it does not alter the file in any way, so it does not create more artifacts. You can open and view a JPG file a jillion times without any concern (a web page for example). The artifacts are created only when the data is compressed for saving it as a JPG file. This happens only at the menus FILE - SAVE or FILE - SAVE AS or FILE - SAVE FOR WEB when you select JPG format.

Archive your important master copy images in a non-lossy format (TIF LZW and PNG are very good, and compress moderately), and then also make a JPG copy if needed for view-only purposes that need it to be smaller, like email and web pages. You won't gain any quality by converting JPG to TIF now, because that image copy will still contain the JPG artifacts it had before. It is part of the image now, there is no way to improve it again. However, if you do need to edit a JPG, then saving it as TIF will prevent adding more artifacts by not doing another JPG Save, so TIF would be a good plan then.

If you find that you must edit the JPG image and must save it as JPG again, at least try to use the same program and same value of Quality or Compression every time you save the file. Using different values will use different parameters that will aggravate the damage due the lossy compression. I am certainly not suggesting repeated saving of JPG files with the same parameters is a good thing, but only that there are even worse ways to do it.

JPEG Lossless Rotation

Sometimes for viewing, we need to rotate an image between horizontal or vertical (Landscape or Portrait), without needing any other editing operations. But if you save that rotated image as JPG, that is another SAVE operation and additional JPG artifacts. But there are image programs that can rotate a JPG file image exactly 90 or 180 degrees, and then save it again without additional loss, by rotating it without uncompressing and recompressing it first, thus preventing any additional JPG artifacts. This option merely rearranges the row and column data, without uncompressing that data. So while the JPG file itself is still lossy, the lossless rotation does not create additional artifacts.

Jpegclub.org has a list of programs that support this lossless rotation feature. Standard photo editor programs typically do not provide this option, but a few of the better known programs that can do this are

IrfanView    Free, Windows
GraphicConverter    Trial available, Macintosh
ThumbsPlus    Trial available, Windows

IrfranView needs its free extra JPG plugin package to provide lossless rotation, which is then found at menu Options - Lossless JPG Operations when the JPG file is open.

Irfanview also shows the JPG EXIF information well (Exchangeable Image File Format) - extra file data added by cameras showing information like camera name, date, f-stop, shutter speed, exposure compensation, metering and flash used, etc.

Continued


Copyright © 1997-2010 by Wayne Fulton - All rights are reserved.

Previous Main Next