When converting scanned text to a 1-bit black-and-white image what are some filters that one can apply in the process to improve the result? Right now I am running into the problem where dithering errors make the image look horrible.

Update: I think trying to undo dithering is a much harder problem. How can I convert the first image to a monochrome image? The default approach convert -monochrome img1 img2 is shown below. I've also tried a two-step approach: 1) decrease depth (color palette) and gamma 2) convert to a bilevel image (not shown). Other things I played with included imagemagick's ordered-dither (at various settings), but it wasn't as good as the two-step approach.

text image monochrome image

  • 1
    $\begingroup$ Adding some more detail or examples of what you're talking about would help get you some good answers. $\endgroup$
    – Jason R
    Nov 23, 2011 at 4:11
  • $\begingroup$ Also adding a picture would make it more easy to understand what's the problem is $\endgroup$ Nov 23, 2011 at 11:43

2 Answers 2


I would suggest for this case that you upsample and apply a slight blur and then a sharpen, then apply the threshold operation. You won't get any more information from the pixel data, it's simply not there. But you'll get a smoother result out of the thresholding operation, and you won't need to dither. The end result is like a photocopier degradation.



Also, this is what it looks like when you just use a better diffusion dither algorithm ;)

enter image description here

  • $\begingroup$ Thanks, I was thinking of using blurring, but didn't know how because it's generally meant to reduce image quality. If we look at the dithered image we'd like to connect nearby pixels. Would a blur be the only filter "connecting" the dots? What tool did you use for that diffusion dither algorithm? $\endgroup$
    – m33lky
    Nov 24, 2011 at 5:08
  • $\begingroup$ The blur only takes place after the upsampling (the image you posted already appears upsampled 2x) so we're not losing image detail in the process. This dither comes from Photoshop. Photoshop gives the option for Diffusion, Pattern, or Noise dithering modes. $\endgroup$
    – Matt M.
    Nov 24, 2011 at 7:17

What you are looking at is called and un-dithering. Theoretically, the problems is ill-posed if you want to reconstruct exact images prior to dithering and printing. However, some linear filtering over a broader window (depending on the amount of quantization of dithering) can be applied. For example, in your case, you can take a collection of total score of 8x8 window and apply the sum that would give you the intensity in terms of 0-256.

The paper listed here is the solution to your exact problem.

Ok, if i have understood, since you are scanning the image rather than taking a digitally dithered image, your problem is not much of un-dithering. I answered the first part before your update.

Ok, on this case, i would suggest that you can have two step process.

  1. find an optimal threshold to convert the image into a bi level image. This is best done using trying the find the "valley between the white and black intensities within the histogram. See here for basics on thresholding. But may be you have tried this as well.

  2. Now, you might see that some of the edges might be too thin or too thick depending on the type of noise. So in order to reconstruct more optimal image you can apply morphology with operations like Dilation and Erosion.

See this presentation for reference. This will give you a direction of what i was saying. Here is a reference on how to apply various morphology filters

  • $\begingroup$ This is a great paper but not exactly the problem since we start with the image prior to dithering. $\endgroup$
    – Matt M.
    Nov 24, 2011 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.