How to convert old scanned documents into black and white

enter image description here

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: I use Photoshop.

26.4k 11 11 gold badges 73 73 silver badges 122 122 bronze badges asked Aug 18, 2013 at 17:04 user2496077 user2496077 363 1 1 gold badge 3 3 silver badges 5 5 bronze badges

Might be very difficult with such a dark background. Usually you would go about this with a levels adjustment in Photoshop

Commented 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.

Commented Mar 21, 2015 at 14:59

6 Answers 6

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.

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.

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.

answered Aug 18, 2013 at 19:09 Alan Gilbertson Alan Gilbertson 47.5k 5 5 gold badges 77 77 silver badges 148 148 bronze badges Thanke you, i will try the third variant, that's what i need :) Commented Aug 19, 2013 at 12:35 It's a two step process. Use both steps for best results. Commented 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

Commented Jan 18, 2016 at 23:16

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

It's called Nuvola Tools (404, source backup: https://github.com/maximka1812/Nuvola-Manga-Grayscale), and it's mainly focused on scanned art, but you might want to give it a try.

enter image description here

enter image description here

103 4 4 bronze badges answered Aug 19, 2013 at 4:22 26.4k 11 11 gold badges 73 73 silver badges 122 122 bronze badges
  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.
20.1k 12 12 gold badges 80 80 silver badges 145 145 bronze badges answered Feb 8, 2015 at 17:44 91 1 1 silver badge 2 2 bronze badges Wow, this worked surprisingly good! Thanks, man! Commented 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.

Commented Jul 22, 2016 at 6:01

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.

answered Feb 24, 2014 at 12:17 21 1 1 bronze badge

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 '/Filters/Set Background to White', # menupath 'RGB*, GRAY*', # imagetypes [], # params [], # results set_image_background_to_white, # function ) gimpfu.main()