By Dr J Floor Anthoni (2003-2006)
|Most images need to be sharp and even where good lenses and fine film are used, sharpening can improve the image just that little extra, but it can also go wrong.|
|Masking techniques give you the equivalent of dodging in the classical darkroom, but it can be done with more precision. Density-dependent masks present advanced possibilities for enhancing difficult images.|
|The JPEG standard for RGB images allows for compression but this comes at a cost or 'loss'. What should you do? What is the JPEG header?|
|Although digital files cannot deteriorate over time, they can easily be lost when your computer's disk crashes. Backup is important. Here are some tips.|
|Here are some practice images to sharpen your skills on. They have been created by computer and degraded with colour cast, contrast mismatch, unsharpness, scratches and noise. It will teach you what can and cannot be achieved.|
One of the most used new digital darkroom tools is the ability to sharpen an image. It is also easily overdone resulting in irreparable damage. That's why we have saved the image after certain important stages before sharpening. Every blurred image still has sharpness in its noise and grain. By sharpening the image, also these artefacts are exaggerated, resulting in a messy image. So what should we do?
|the unsharp mask
Let's first understand how the most important sharpening tool, the unsharp mask works. The diagram shows how an image has a sharp boundary from light to dark grey as shown in the solid blue curve, but the photograph shows a soft boundary as in the red solid curve. If we could apply a correction as in the blue dashed curve, it would be fully sharp again, but such a correction cannot be made from thin air. The unsharp mask blurs the image further as shown in the green solid curve, but this intermediate stage is not visible. It only exists in a patch of pixels given by the radius parameter. Think of it as a sliding window. For each pixel the algorithm now calculates the difference with the original curve (in black) and adds a percentage of this difference to the image (red dashes). As can be seen, the image appears to have sharpened but at the cost of an unwanted side effect, a kind of bump or halo as the dashed red line overshoots. Note also that these two bumps increase contrast which makes the image appear sharper.
|Tip: don't use the unsharp
mask in one go but apply it several times with a narrowing radius. This
makes sense because after sharpening it a bit, the image has become sharper,
deserving a smaller radius or sliding window. In a 3000x2000 pixel image,
try a radius of 8 pixels and 10-20% until the halo just (or just not) begins
to show. Now reduce the radius to 6 at 20% and repeat this once, then 4
if that makes sense (see note below!). Usually the graininess will
have increased to the extent that further sharpening does not improve the
image. Some images may benefit by starting at a radius of 10 pixels, particularly
where the image has a limited depth of field. However, look critically
at the result and if it looks rather gritty, you may have gone too far.
You can always do it just before printing/selling while leaving your original on file somewhat unsharp.
Note that Adobe Photoshop and Corel Photopaint have different traditions in defining the mask or blur radius. In Photopaint, the radius of the mask's sliding window is meant, whereas in Photoshop the number of pixels of visible blur, divided by two. So where the transition from black to white takes three pixels, the blur radius is 1.5 for Photoshop, whereas this would correspond to about 4-6 in Photopaint.
It will be clear by now that proper sharpening is almost an unattainable feat, but sharpening filters have recently become available that give you full control, while providing such tricks as cleaning up the resultant halo. We can recommend the sharpening filters by www.powerretouche.com
The adaptive unsharp tool analyses the image first for its high-frequency component and then applies an unsharp mask. In practice it works very well with images that have been resampled/made smaller, but is of little value to your original large image where noisiness from grain still prevails. To sharpen web pictures, the adaptive unsharp mask is indispensable.
The smart sharpen tool analyses the image first for contours and then applies an unsharp mask. It is based on the idea that sharpness is most important on contours or outlines of objects. If your photo editor does not provide this, you can make an outline mask yourself but it is time-consuming.
The sharpen tool is of use only in smooth images. Its algorithm basically compares each pixel with its neighbours and exaggerates the difference. It can be used with success to exaggerate contours in smooth graphics work, but for enhancing photographs which have some noise, has little value.
The jaggy despeckle tool is a sharp blurring mask that compares each pixel with its neighbours, pulling peaks down nearer to their average ('tall poppy' tool). As such it is a sharp blurring tool that removes signal noise and a great deal of graininess without affecting image definition much. It works best on images that have been oversampled to larger files. When enhancing images from grainy high speed film, this tool becomes indispensable, particularly for areas of the image where noise is distracting, such as the blue sky.
Note that film grain comes in many sizes. It so happens that large silver crystals are more sensitive to light. Thus the largest grains are found in the darkest tones. When shooting with neg film it therefore pays to overexpose your film as a matter of principle, by 0.5-1.0 f-stops. This also brings better colour rendition into the dark shadows, but it also brings more scanner noise in the highlights and it may affect sharpness by a slight halo effect. This is the reason that some scanners do a very poor job of neg film, something that does not show in their official specifications. The best scanners do a pre-scan which adapts scanning speed such that dark images take longer to scan than bright ones, and signal quality is not compromised.
It is also a fact that CCDs produce the most noise in the darkest signals, which correspond with the dark areas in slide film and with the highlights in neg film. Thus neg film scans suffer from noise both in their highlights and shadows. Fortunately the human eye is most sensitive to noise in the mid tones.
Note also that both the colour film and CCDs have a problem with red colours which are less energetic than the greens and blues. The red wavelengths have less quantum energy to free electrons from either the emulsion crystals or the CCD pixels. As a result their digital signals become more prone to noise. In underwater photography with negative film, this may pose a problem.
|Tip: apply the jaggy despeckle blurring tool to the largest image possible. It could be your original of 30MB or one resampled (oversampled) to this size or even larger.|
The word low-pass comes from communication and radio technology. A low-pass filter blocks high frequencies and a high-pass filter blocks low frequencies. A band-pass filter blocks all frequencies outside a band. The low-pass blurring filter does something similar to the jaggy despeckle but acts more smoothly, as it comes closer to the way an imperfect lens would blur sharpness. It often works well after applying a jaggy despeckle first. It is excellent for portrait photography. Use it to smoothen the image somewhat after sharpening, as it is more precise than the jaggy despeckle.
The Gaussian blur tool is a serious smoothing tool. Its name derives from the mathematician Gausse who identified the bell curve of normal deviation around an average. The idea of the Gaussian blur is to compare each pixel with its neighbours while giving each a weight according to a bell curve around that pixel. In practice it causes very severe but nicely smooth blurring, useful for serious blurring applications but not for removing noise.
|Note! We say it here once
again that some noise on an image is preferable to no noise at all, provided
it is evenly distributed and not patchy. Noise increases the colour
accuracy and definition of your images. Without it, you may introduce
quantisation noise which shows as stepwise increases in density in the
form of rings and other artefacts! Remember that three pixels coding an
intensity of 43, 42, 43 average out at 42.67 which represents an increase
in colour definition.
Note! The shadows (the fourth and fifth f-stop) have only a few digital levels (8-16) which makes them susceptible to quantisation noise. Leave sufficient signal noise to make them appear smooth. In this area the removal of noise must be done with care.
|oversampling and resampling
Oversampling and resampling can be used as a high frequency blurring tool. Essentially oversampling to a larger image size creates new pixels which are given an intermediary colour and intensity calculated by averaging the surrounding pixels. It is similar to the jaggy despeckle discussed above but more subtle. Resampling to a smaller size does something similar. Thus their combined effect reduces high frequency noise. It can therefore be desirable not to remove all noise from your original images since much of it disappears when resampling to the size as needed by a customer.
|Note! signal noise in your image shows worse on screen than in reality because for the sake of speed, the reduced image you are viewing is not resampled to that size. Instead the photo editing program grabs pixels at intervals near enough to present an impression. As a result, noise appears exaggerated. If possible, do a proof print on your high quality printer before removing noise.|
|smart sharpening and blurring
One can go about sharpening in a more logical way by realising that only the edges of an image need sharpening but not the smooth bits in between. This is done by smart sharpening. Eventually this method will become available as a point-and-click filter, and both Photopaint and Photoshop already have a smart blur filter that can be applied after normal sharpening or for reducing JPEG file size for Internet or for artistical purposes..
|Tip: you need to do this a few times to get the hang of it and to find what are the best settings for the quality of photo you are used to. The resolution of your photo affects all settings. Make a note.|
Masking is essentially digital dodging but it goes much further. A mask is a clever invention of the makers of the photo editing software. It is essentially a grey scale image where the intensity zero means don't (or 0%) and 255 do (or 100%). The values in between are treated accordingly. A mask can be applied to every tool in the tool kit, including the tone curve tool, colour correction and sharpening discussed above. These tools essentially scan the image pixel by pixel while doing their calculations. If a mask is present, the effect will be multiplied by the mask's value (0-100%) and applied.
Where subject lighting is uneven over the height or width of the image, a gradient mask can be of enormous help. In underwater closeup photography the strobe light brings more light on its near side than on its far side, regardless of how careful one places this artificial light source. A linear gradient mask can compensate for this unwanted effect.
|Tip: gradient masks work
best when darkening with the tone curve tool. On the very righthand side
of this tool, slide the highlights down while maintaining a straight line.
The highlights darken but also become washy. Pull the mid tones down until
the slope in the highs matches the slope of original straight line. You
have now restored contrast. If necessary, invert the mask and pull the
mid tones up, which will brighten the dark side of the image. Use the S-curve
to finish the image.
Note that although the effect appears small while you are applying it, it makes nonetheless an essential improvement to a good photo. Note also that the one f-stop of the highlights covers half the signal (128-255) and this leaves more room for adjustment than the darks would.
f032809: photo of a giant heart urchin in uneven lighting. The original shows its belly spines almost over exposed, such that contrast could not be enhanced further. A gradient mask was made and the light part darkened by 20 units. Then contrast and lightness were enhanced to give the balanced result on right.
|Tip: squint your
eyes while observing your photo to see the lay of the gradient mask.
Tip: don't overdo it
Tip: for darkening the sun, use a radial gradient.
An area can be masked in various ways using a variety of mask-making tools like the rectangle, ellipse, freehand, lassoo, the paint brush, and the magic wand. How to use these is not the purpose of this chapter, but what to do with the mask, is.
The most important option of the mask is feathering.
It is a kind of blurring which can extend across hundreds of pixels. It
can be directed across the middle of the mask or inward or outward. It
enables us to apply the effect gradually.
The next most important option is paint on mask. This treats the mask as a standard grey scale image on which you can paint, rub out, blur and do anything else. By turning paint on mask off again, the photo editing program works on your colour image again.
Area masking can be used for bringing the bright sky in line with the
darker field. Take the freehand mask making
tool and draw a mask around the sky on you image. Irregularity is better
than a straight line. Then select feather
and blur the mask inward by the amount required (say 10 pixels). Note that
these 10 pixels produce ten steps from 0 to 255. You can blur these steps
further by selecting paint on mask, then effect/blur/Gaussian
blur and blurring these steps till they look smooth. Deselect paint
on mask again. The mask overlay shows
you what the mask is doing. Now apply the tone curve
tool and darken the sky by pulling the curve down in the middle. Achieve
no more than 0.5 fstop.
Invert the mask so it works on the rest of the picture. Now use the tone curve tool to pull intensity up by 0.5 f-stop, until the desired effect is reached. It is natural to overdo this in the beginning. Save the mask and turn it off to study the artefacts in the transition region.
Since the mask overlays the sky, it can also be used to smoothen the
sky while also sharpening the field. Retrieve the mask from where you saved
it. Apply Gaussian blur or jaggy
despeckle to the sky but always leave some noise for improved colour
Now invert the mask and sharpen the field using the unsharp mask. Check the boundary area for anomalies.
||Area masks can be applied in a subtle manner.
Here the contour of the Snell's circle and the two 'holes' in it, was traced
by hand, then feathered by 10 pixels for a smooth transition. The sky was
darkened with the tone curve tool.
The auto adjust could be used because it nearly got it right. However, because there are no whites in the image, it exaggerated the reds which also make the picture murky and dark.
After colour correction the image was blurred with the jaggy despeckle since it was taken with high speed film. The image was then resampled to about 3000x2000 pixels and sharpened twice.
In a good image often the small differences matter.
|How important are masks?
The world today (2017) is flooded with image editing software, many available for free (like Picasa). However, if such apps do not provide masking and mask creation, give them a miss. Masks are THAT important for the professional and serious amateur!
Masks that are created from the intensity of the pixels have a flavour of their own, offering a wide range of possibilities. In the diagram we have drawn a density-dependent mask suppressing the bright mid tones where our eye perceives sharpness most. In the example the mask produces a grey scale image with exaggerated contrast (steep slopes in the tone curve). For the result, see the 'mid-tones' greyscale image of the cave diver above. Check whether the areas where sharpness is required show dark. Then use the mask to blur highlights and darks. Invert the mask to sharpen the mid tones. A similar density-dependent mask can be used to bring the sky in balance with the field, as described above.
Note! although it is possible to enhance poor images considerably, nothing works as well as starting with a good image!
In this chapter we'll discuss the various options available for compressing your images.
First of all, nothing compacts more effectively than resampling your image to the required size. Halving the size of your image reduces the number of pixels and thus the file size by four. Cropping your image such that only the most important parts remain, is also very effective.
It is important to remember that the resampling process is akin to
averaging and blurring, resulting in an unsharp image which needs to
be resharpened. Also remember that small images need to be oversharpened
to appear naturally sharp to the human eye. Use the adaptive
unsharp tool for this, with a 25% effect. Use it twice or three
times to achieve sufficient sharpness.
By converting a colour image to greyscale, the size in memory is reduced threefold because each pixel represented by three bytes for RGB is now represented by a single byte. However, when saving as a JPEG compressed file, greyscale images are not remarkably more compact than colour images!! Thus for saving file space, it is not worth losing the colour of your image.
The GIF (Graphic Internet File) is a very clever standard for paletted images consisting of only few colours (255 max). The large 400x270 pixel diagrams on this page typically compress to less than 10KB whereas these would take 50KB in JPEG. However, for colour photographs the paletted form is totally unsuitable.
Where a drawing is done in few colours, the potentially compact file can become large if anti-aliasing is chosen which blends edges such that the alias or steps don't show. In our web site we have chosen to show alias (see the slanting lines in the diagram above) to achieve compactness.
Note! don't use GIF for photographs.Note also that the GIF (Graphic Interchange Format)is intellectual property of Compuserv (1987), reason why it is often avoided.
The JPEG standard (Joint Picture Expert Group) is used worldwide to compress colour RGB images or greyscale images. Allthough used by nearly everyone, I think that hardly anyone understands what it does and how to use it properly.
JPEG compresses colour or greyscale images by making use of the way we see: luminosity (brightness) is more important than colour detail, and many pixels in the image look alike. The RGB colour profile is first converted to a YCC profile using a simple and fast algorithm (luminosity, colour 1, colour2) such that luminosity gains most importance (Y:C:C= 4:2:2).
Then it divides the images in 8x8 pixel cells, traversing each cell diagonally from top left to bottom right, looking for similarities. This 'Huff coding' compacts the bit stream in a reproducible way but it creates dissimilarities between cells, such that the cells become visible. Depending on the amount of compression desired, more or less detail is lost. Thus JPEG is considered a 'lossy' compression technique, which is true when driven to extremes. However, the original data file can be compressed 5-10 times without visible loss. The file can then be retrieved and saved using the same amount of compression, without it deteriorating further. So the combination of an sRGB profile with JPEG compression to 5-10x, is the way to go.
For more info: www.jpeg.org
So, JPEG does not need to suffer losses in picture quality if only little compression is used. One of the problems we have is that JPEG allows for a continuously adjustable rate of compression from 0 to 255, but what these levels mean is not immediately clear.
What we must realise is that JPEG compression does not lead to a predictable file size. If you have a busy image, a larger file results. If you have much pixel noise, the image becomes larger too. Ironically, removing noise from an image results in a smaller JPEG file! Compression does not produce the same losses on all files. Large files can be compressed more without noticeable loss, whereas small files cannot.
So what happens as one compresses an image further and further?
|Rate *||file size||Losses showing|
|10||20-30%||No visible losses. This compaction rate is almost suitable for your originals.(Better use rate=5 and YCC=4:4:4)|
|20||8-20%||Losses begin to show, particularly on sharp boundaries, but this compaction is acceptable for your photo album of snapshots, as losses do not show in print.|
|40||4-8%||The losses begin to show in print, although seen with difficulty and only to the very alert observer. Not suitable for filing but very suitable for slide shows and screen sized images, comping and high quality internet files. All photos shown on our web site are of this quality.|
|80||2-4%||The losses and artefacts begin to show on screen. This is the highest compaction one can do for small internet files. In smoothly grading colours, steps or bands may become visible. Note that a small image is much more affected than large images.|
|160||0.8-2%||This very compact file can occasionally be used but artefacts and losses are clearly visible. Still, it is amazing how well it works for large files. Don't use it for small files.|
One could fear that losses may accumulate each time the image is altered and saved again. However, for compression rates of 10 and 20, this is not perceptible. Besides, the compression algorithm makes the same decisions as long as the image was not changed in size.
How do I recognise JPEG damage?
|Note: The above compression rates are not absolute, since small pictures suffer long before large pictures do.|
What is the JPEG header?
When you compact the photos from your scanner or digital camera, you may notice that they are reluctant to become more compact than 45-60KB, no matter what you do. This is caused by the fixed JPEG/JFIF metadata header placed there by the camera or scanner. This header contains all the photographic or scanner details (JFIF standard) and a small bitmap thumbnail picture of about 30KB, which is seldom used but confuses the display thumbnails option of Windows Explore. You want to get rid of this fast, but how?
You won't find a suitable option in Photoshop or Photopaint or other program, so you need a drastic solution in the form of the free JHEAD.EXE program from http://www.sentex.net/~mwandel/jhead/. Unfortunately it runs in command mode but it is very good at that and it is very small and does not interfere with Windows and it is available for Linux, Mac and other operating systems. Find it on the web and download it in the c:\windows directory. Windows will find it. It comes with a manual.
Suppose your compacted files are in the directory c:\mypix\ Proceed as follows:
A new compression algorithm is under development, based on wavelet rendering. Rather than dividing the image up into arbitrary 8x8 cells, the wavelet algorithm pays more attention to the continuous predictability inside the image, in all directions. In doing so, it is able to compress more with fewer side effects. It looks as if this compression algorithm is a serious step forward in compression technology, particularly for achieving more compactness with less visible effects. At the moment it gains some 20-30% advantage, which is not enough to make the switch from classical JPEG compression. Besides, not all browsers and systems are capable of handling this new file format. But JPEG2000 has an innate ability to remove noise that does not belong while retaining edge sharpness where it does belong.
In digital form your images will no longer suffer from the tooth of time. No more fungus, ageing, and so on. But you can lose them in a split second when your hard drive gives up the ghost. So backing up is important. Equally important is a filing system that allows you to retrieve your images when your customer orders one. These will be the subjects of this subchapter.
Suppose you end up with file sizes averaging 3 or 6MB. Suppose you are
able to back your files up on CD with a CD-ROM burner. Each CD reliably
stores 640MB (don't be enamoured by 700MB as this limits playback on some
systems). Thus your CD stores between 100 and 200 images. If you have a
scanned library of 3000 images, this would require 10-20GB or 20-40 CDs.
You may have this much space on your hard drive but when your scanned library
reaches 15,000 shots, you will have most of your images 'off-line' on CDs.
By that time it is handy to have a local library of comping images (900x600
pixels at compression rate 40 = 4-8% of your off-line library). So you
might as well build this one up from the very beginning. They also give
you a good slide show.
|Tip: CDs consist of a less than hair-thin layer of metal held between two plastic discs. Music CDs and DVDs are made in a single press where a master disc with the reverse image is pressed into the thin metal layer, thus transferring a massive amount of information in a flick of a second. The most popular material used is aluminium and this can degrade over time by oxide rot. A standard CD does not last forever, but one with a gold layer does. With some care you can buy real gold-layered discs for burning, and they don't cost much more. Don't consider anything less. As yet, gold layered DVDs are not available.|
|Tip: recent versions
of Windows allow you to select a slide show as a screen background. Right-click
on your desktop; select properties then the
tab. Select my picture show from the available
options and adjust its settings according to your taste. This also tells
it where your pictures are stored.
If you have an earlier version of windows, get the free program GPhotoShow from the Internet. It also handles sound and has a few nice settings for transitions and so on. It is activated as shown above.
Recent storage technology has produced disk drives with capacities over 300GB! It may pay to acquire such a drive if you expect to produce many images. It can be housed in an external box connected to the PC by USB (Universal Serial Bus) or by firewire, and in this manner it also becomes portable and can be saved in a fire proof safe. This allows you to turn it off most of the time, which lessens its chance of self-destruction or corruption by Windows. But remember that a hard drive is no excuse for not making backups to CD.
Recent versions of windows allow you to view the contents of directories
as thumbnails and this is very handy. However, the program (Explore) is
rather primitive and cannot remember thumbnails very well even though it
thumbs.db files. To say
it nicely, it is a time waster. Microsoft never appears serious as to the
quality of its products. The Explore program,
after over a decade of improvements, is still unable to print the contents
of directories and likewise, the thumbnails. So you cannot use it to print
a directory of thumbnails on paper, for inclusion in the CD jewel box or
for making a paper reference to your stored images. Remember that scanning
a paper index of thumbnails is very fast and you can scribble notes on
|Tip: you can buy
a handy and fast picture management program called CompuPIC from
the Photodex Corporation on Internet (www.photodex.com) and this
is well worth the investment. It allows you to view directories fast and
conveniently and it also enables you to print them on paper in the size
most suitable to your requirement. So you can have a folder of printed
thumbnails of your entire off-line library for fast reference.
Tip: why not use the free and excellent thumbnail program CPicture from www.cpicture.net? It contains many useful features for file management. For Linux users there is Gwenview.
It is a pity that the JPEG standard does not allow for inclusion of
keywords and a picture description. In fact, it does. But the standard
is not adhered to and Photoshop eliminates the text. However, one day such
anomalies will be ironed out and you will be able to include searchable
text with every photo. The program to search and manage this facility already
exists (Ujeta from www.moon1000.com) and if your picture editor retains
JPEG comments, this is a way to go.
It took me a long time honing my skills on my images and this will undeniably be a necessary learning curve awaiting anyone attempting to master digital darkroom skills but there is a faster way. Here are some practice images to hone your skills on. They have been produced by computer, enabling you to master your skills more quickly.