What do you do when you need a bitmap image but only have a grayscale image, possibly with midtones? Here are three techniques to get you good line art
My recent tutorial on eliminating jaggies from bitmap images was responded to by Mac Wizard,
Rather than trying to convert back to bitmap, you could add an adjustment layer of curves and pull the diagonal line vertical, black point to 125 and white point to 125. By adjusting the horozontal position of the vertical line (does that make sense?) you can adjust how much or little the white fills in. ie. Black and white point at 20, or 200.
It’s a great technique for making a grayscale image more like a bitmap, whether for a bitmap conversion later or just to clean up your grayscale image. I promised Mac Wizard I would present a tutorial on grayscale images, and here it is. I am going to cover three different techniques that anyone can use to drop out gray values and end up with black and white images that are very suitable for a bitmap conversion.
This technique was shared by Mac Wizard, and here we’ll use it on Figure 1, the Calligaris logo, a real-world example that I had to clean up after the client could not produce a specimen of better quality.
Step 1: Open the Curves dialog box. Keyboard command is Cmd-M (Mac) or Ctrl-M (PC).
Step 2: Click-drag the Eyedropper tool over a the dark and light areas and note where they lie upon the curve. As you click-drag you will see a circle along the curve line where those values lie (see Figure 2). This is an optional step; you can experiment with steps 3 and 4 if you like until you find a final image that looks best to you.
Step 3: Drag the black point of the curve horizontally until it is beyond the range of dark values.
Step 4: Drag the white point of the curve horizontally until it is beyond the range of light values.
At this point you will have a steep straight line in the Curves dialog box, with previously dark values falling beyond the black point and light values falling now beyond the white point. See Figure 3 for an illustration of the technique at work on the Calligaris logo. If you see specks of white in the black areas (or black specks in the white areas), then a few pixels were not in the original range from Step 2 and can be cleaned up by dragging the black and white points farther in and steepening the line (see Figure 4). The line can go so steep as to be vertical, with the black and white point having the same value on the grid; this is what Mac Wizard mentioned in his post. Tip: You can still use the Eyedropper tool to sample the stray pixels and see where they lie on the curve line. Even though they appear black or white, that is the Curves preview at work and using the Eyedropper will reveal their original values.
At this point the grayscale image (Figure 5) is now clean and, after eliminating jaggies it will be ready to be converted to line art.
I prefer using Levels to accomplish the same thing Curves done above, because the Levels histogram makes for an easily-read visual interface that makes this job a cinch. If you are a visual learner or find it easier to work with things you can see and manipulate, then this technique may be better for you.
We’ll use the same Calligaris example, Figure 1 above.
Step 1: Open the Levels dialog box. Keyboard command is Cmd-L (Mac) or Ctrl-L (PC).
You’ll see two large peaks with a deep valley between them; see Figure 6. Images with a large dark region and white region will always produce a histogram like this.
Step 2: Drag the black input slider to the right until it is beyond the left peak.
Step 3: Drag the white input slider to the left until it is beyond the right peak.
Figure 7 is the altered Levels dialog box; Figure 8 is the resulting image. Levels changes the pixel values in exactly the same way as Curves did, but the quick visual feedback of the histogram makes it quick and easy. Levels (and Curves, for that matter) do not work as well with more difficult grayscale images such as Figure 9, which has some midtone grays as well as darks and lights and produces a Levels dialog box (Figure 10) with a smaller valley than the Calligaris logo. The technique remains the same, but it will be harder to find the right positions for the two sliders and you may need to fiddle with them as we did for the Curves technique by bringing them even closer together to eliminate any gradations between black and white.
The Curves and Levels techniques above are useful for preparing a grayscale image for a clean conversion to a line art bitmap using the 50% Threshold method. However, if the original image is fairly clean to begin with, with large and relatively uniform areas of dark and light values, it may not even be necessary to use Curves or Levels to bring the darks to black and lights to white. Just let the bitmap conversion do it for you!
In Figure 11 we are back to our original Calligaris logo.
Step 1: Select Image->Mode->Bitmap… and convert the grayscale image to a bitmap, making sure “50% Threshold” is selected under Method.
Easy enough—dark values become black, light values become white (see Fig. 12). The resulting image has some stray white pixels and is not as clean than if you had used the Curves or Levels techniques to prepare it, but for some grayscale images, especially ones with uniform darks and lights, it may be easier to just execute the bitmap conversion. Note Figure 13 below, which is the Levels dialog box and histogram for Figure 12 after converting it back to a grayscale (Levels and other adjustments do not work on bitmaps). Since all values are either black or white, the histogram will show only one-pixel-wide peaks on each end, and trying to perform the Levels (or Curves) technique on this image will produce no results. Even if you drag a slider in Levels all the way to the other side of the histogram, the preview will show change but click OK and the image will show no change.
Mac Wizard’s original post has dug up a few useful techniques for manipulating grayscale images for a clean and easy conversion to line art. I don’t know how many times in a production environment that I’ve had to take a photocopy, fax or lousy business card logo and make into a clean piece of line art that is actually press-worthy. These are the techniques I rely on to spin straw into gold, and I’m sure there are other techniques that have been developed in the field so if you have your own formulae for bitmap conversion make a comment below and perhaps we’ll revisit this topic in a future article.
