mkbitmap examples |
The following are examples of the operation of mkbitmap. This is a
simple program for converting greymaps and color images to bilevel
bitmaps. For usage information, see the
mkbitmap(1) man page. The following images
illustrate the effect of highpass filtering and scaling.
The original color imageThis image was taken from the web cartoon Loxie and Zoot by Grace Crowley. Thresholding without highpass filterIf we apply a simple thresholding method for converting greytones to black/white, we can never quite find the correct threshold. The background becomes black before the foreground is satisfactory. The following images have been thresholded at different levels.
Thresholding with highpass filterHighpass filtering suppresses large-scale irregularities such as background variations, while preserving small-scale detail such as lines. Filtering depends on a parameter called the filter radius, which corresponds roughly to the size of features that are preserved. The filter radius can also be identified with line thickness. The following sequence of images illustrates the effect of the filter radius parameter.
Scaling before thresholdingA greymap contains more information per pixel than a bitmap. Normally, when thresholding, this extra detail is lost. However, one can recover some of this detail by scaling the image to a higher resolution (using interpolation to calculate intermediate pixels) before applying the thresholding step. The following illustration shows our image, scaled by a factor of 2. The first illustration shows the result of scaling after thresholding, and the second illustration shows the result of scaling before thresholding. Clearly, the second image retains much more detail than the first one.
Passing the output of mkbitmap to PotraceThe following two images illustrate how the output of mkbitmap can be passed to Potrace. The first image has not been scaled before thresholding. The second image has been scaled before thresholding, Thus, in the second image, a higher resolution bitmap was passed to Potrace. It is clearly visible that the second image shows much more detail than the first one. This is particularly evident in the text section.
SummaryIf the image to be traced is available as a greymap (for instance, as a result of scanning), it is a good idea to use a program such as mkbitmap to apply an optional highpass filter, and to scale the image before converting it to a bitmap, rather than using a simple-minded thresholding method of the kind which is built into Potrace itself.
selinger@users.sourceforge.net / PGP key |