26

I have some old documents that have been scanned, and I want to convert them to black and white. Content should be always black, and background white:

enter image description here

I use Photoshop.

2
  • Might be very difficult with such a dark background. Usually you would go about this with a levels adjustment in Photoshop Aug 18, 2013 at 18:44
  • Thank you for your answers helped a lot. I was still having problems after converting to black and white, so i worked some out in levels and still had some greying going on. So I went into adjustments and shadow/highlights. This worked out very well, messed with it to the max and brought it to one dark shadow towards the side of document and went in used the magic wand at 90% from their and used the eraser to clean up around the edges and text. Zoomed in and painted in to fix a couple of the letters. I love Photoshop.
    – user41141
    Mar 21, 2015 at 14:59

6 Answers 6

18

If you have control over the scanning, or can get them rescanned, increase the contrast setting in the scan and set the black point at the darkest bit of text you can find. That would make the steps below easier. If not, read on...

Here's part of a fairly typical old document scan:

Scan of old document

The details will be different depending on the document (this has somewhat higher contrast than your sample, for example) but the broad outline will be the same.

  • Convert to grayscale using a Black and White adjustment layer. Use the Targeted Adjustment Tool ("Scrubby") in the adjustment layer panel to lighten the background (scrub to the right) and darken the text (scrub to the left) as much as you can.

Black and White Adjustment layer

Notice that the yellows slider is far to the right, lightening the yellowish background. I was able to darken the text only a little.

  • Use a Levels adjustment layer to increase the contrast.

Levels adjustment

This gets you 95% of the way there. A scanned document typically has a histogram with a large lump toward the right (the paper) and a smaller lump toward the left (text). You'll have to experiment with your documents to find the right settings.

From this point, you can duplicate the image, flatten the duplicate, and use your regular Photoshop retouching tools to clean up the remainder.

3
  • Thanke you, i will try the third variant, that's what i need :) Aug 19, 2013 at 12:35
  • 1
    It's a two step process. Use both steps for best results. Aug 19, 2013 at 21:11
  • very nice toturial daah would like to take an exercise to change the style in order to make easy task Jan 18, 2016 at 23:16
11

You mention Photoshop, but in case you are interested there's also a GIMP plugin that does advanced grayscale cleaning and processing:

  • Removes speckles
  • Fills white pores on black ink
  • Removes specific user defined shapes
  • Has damaged lineart regeneration
  • Topological decomposition

It's called Nuvola Tools, and it's mainly focused on scanned art, but you might want to give it a try.

Before:

enter image description here

After:

enter image description here

Source: GIMP Plugin Registry

9

With GIMP:

  1. Open a file.
  2. Convert your document to grayscale: Image → Mode → Grayscale.
  3. Select the background color: Select → By Color, click with mouse pointer on the color of the background.
  4. Invert the selected color: Select → Invert.
  5. Copy the selection: Edit → Copy.
  6. Create a new file: File → New.
  7. In the dialog of a new file, in field: Advanced Options choose: Fill with: White, hit Ok.
  8. Click anywhere in the window of the new opened document, just to choose it.
  9. Paste the content of a clipboard: Edit → Paste.
  10. Add a new layer to enhance the black text: Layer → New from Visible, in the layer's palette, in field: Mode: choose Multiply.
  11. Combine two layers: Layer → Merge Down.
  12. Save the result as a JPEG file: File → Export As, choose jpeg and set the quality at least 60.
2
  • Wow, this worked surprisingly good! Thanks, man! Nov 13, 2015 at 11:14
  • Found this way faster than the CS6 solution. When printing, there was still a visible,greyish background behind the scanned image.
    – tinonetic
    Jul 22, 2016 at 6:01
2

I tried various mentioned methods incl. free FineThreshold http://www.mehdiplugins.com/english/finethreshold.htm plugin. This plugin produces good results quickly provided that the document is homogenously lighted and the paper itself is also of homogenous quality. However this was not my case. I experienced that the upper side of every document was more light than the bottom. Consequently, every method and its partial setting worked well only for the part of every page and not for the rest of it.

Eventually I found the effect "Dynamic Thresholding" which is part of Zoner Photo Studio v15. Its eval version is free for some period, I guess. It seems to offset the b/w threshold according to the neighbourhood lightness. Its application is one-step process only. For me the parameters "Large, value +14" worked very well. Beside "Editor" Zoner contains also the "Manager" interface in which you can process the batch over all selected images. In the end I was able to print the result on the very old 300 dpi laser printer with excellent contrast.

Now, the only remaining task for which I am looking is automatic CROP of every image in an inteligent manner to cut-out the unnecessary margins. Any hints are welcome because manual cropping is boring as well as time consuming.

2

There was a plugin in the GIMP plugin registry that did this. It's archived here now.

Some time ago I translated this to Python and it ran a lot faster.

Here's the result of its application to the image in the original question:

enter image description here

Here's the result of its application to the image in Alan's answer:

enter image description here

Anyway here's the code of the plugin:

from __future__ import division
import random
import gimp, gimpfu

pdb = gimp.pdb

sample_count = 100

def set_image_background_to_white(image, drawable):
  pdb.gimp_context_push()
  pdb.gimp_image_undo_group_start(image)
  pdb.gimp_progress_set_text('Correcting background')

  if drawable.is_gray:
    channel_count = 1
  elif drawable.is_rgb:
    channel_count = 3

  assert not drawable.is_indexed

  # get some random points in the image
  sum_by_channel = [0]*channel_count
  for sample_index in range(sample_count):
    px = pdb.gimp_drawable_get_pixel(drawable,
                                     random.randint(0, pdb.gimp_drawable_width (drawable)-1),
                                     random.randint(0, pdb.gimp_drawable_height(drawable)-1))[1]

    for i in range(channel_count):
      sum_by_channel[i] += px[i]

    pdb.gimp_progress_update(sample_index/sample_count)

  if drawable.is_gray:
    pdb.gimp_levels(drawable, gimpfu.HISTOGRAM_VALUE,
                    0, sum_by_channel[0]/sample_count,
                    1.,
                    0, 255)
  elif drawable.is_rgb:
    for i in range(channel_count):
      pdb.gimp_levels(drawable, 1+i,
                      0, sum_by_channel[i]/sample_count,
                      1.,
                      0, 255)

  pdb.gimp_levels(drawable, gimpfu.HISTOGRAM_VALUE,
                  0, 255,
                  0.6,
                  0, 255)

  pdb.gimp_image_undo_group_end(image)
  pdb.gimp_displays_flush()
  pdb.gimp_progress_update(1.)
  pdb.gimp_context_pop()

gimpfu.register('set_image_background_to_white',           # name
                'Set image background to white',           # blurb
                'No help info yet',                        # help
                'Robert Fleming',                          # author
                'Robert Fleming',                          # copyright
                '2015',                                    # date
                '<Image>/Filters/Set Background to White', # menupath
                'RGB*, GRAY*',                             # imagetypes
                [],                                        # params
                [],                                        # results
                set_image_background_to_white,             # function
                )

gimpfu.main()
-2

Just try with photoshop. grey scale mode.

1
  • 1
    welcome to Graphic Design SE! We're looking for more complete answers, not just a one-liner. Can you explain how to do that with grey scale mode?
    – Luciano
    Jan 19, 2016 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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