9

I have a notebook photocopied and the photocopy scanned, about 200 pages. For various reasons I need to print this material. There are large amounts of black areas at the sides of the page (after the page itself ends), "black margins".

The image looks like this:

img

I would like to remove the black places, but keeping all text. * The even and odd pages have the black part at different places. * Notably, there is a white edge outside the black one, too! * Most notably, the black areas has no fixed width (I've tried to overlay all the images for even and odd pages separately). It's width varies. The batch algorythm should be able to detect it.

Is there a way to remove these black-white margins automatically, keeping the text?

I can use Windows XP or Linux.

2
  • Note: I cannot rescan this, I do not own the original nor it is available to me anymore, neither is this scan mine.
    – n611x007
    Commented Jun 29, 2013 at 22:17
  • You got a number of answers recommending software for automatically cropping. If the pages look like the sample, I wouldn't trust automated cropping, I'd do it manually, at least for pages where the content extends into the shadow areas. You can easily distinguish what is important and what isn't, but not the software.
    – fixer1234
    Commented Sep 19, 2016 at 3:18

2 Answers 2

7

I would recommend using a free utility called Scan Tailor, which removes borders, straightens and does other fixes to scanned images. Below is the result I got with minimal input to your sample file. While it is hard to say how it will work for an entire batch, but the preliminary results seem promising.

If you are looking for a true scripting solution to the problem you might try your hand at ImageMagick, a very powerful command line utility to work images. Specifically I would look at the sections on removing border and trimming. However I didn't have much luck getting it to work on your test image. You might want to look in the forums, where others seem to have similar issues.

Sample image post processed by Scan Tailor

4
  • this looks like a very handy tool but I'm not sure if it can automatically batch-create parameters for individual pages in a batch apply-to. I think it copies a manually or automatically set parameter from one page to another. Am I wrong, or am I using it the wrong way?
    – n611x007
    Commented Jun 30, 2013 at 9:07
  • reading the manual on the page you linked, I realize now there is a "play" button beside each "step" or "stage", that does some automagic, to and including the current "step". in my case, the results were far from acceptable, so I fall back to using this otherwiser very nice tool manually. I wish the grid and the blurring could be set up explicitly though.
    – n611x007
    Commented Jun 30, 2013 at 9:41
  • If a combination of Apply to... and launching the batch processing (the "play" button) did not yield good results, I apologize, I do not know any other steps to make it work well under batch processing. If you are still interested in the ImageMagick route, I would recommend applying at least two stages - one to remove the white border (pretty easy) and the second to use a blurred version of an image as a kind of mask to subtract away the black borders. Commented Jun 30, 2013 at 16:21
  • ScanTailor works well with PDFs too, via Imagemagick.
    – 0 _
    Commented Jul 10, 2017 at 21:50
4

XnView has a batch processing mode with an auto crop feature:

1

As you can see, the colour and the tolerance level can be modified as required, so that may help.

IrfanView has a similar feature, although it's a bit more hidden. Under Options > Properties/Settings > Browsing/Editing you can set the tolerance value for auto crop borders:

2

You can batch auto crop via File > Batch conversion:

3

If none of these help then you might have to break out the big guns and use something like Photoshop, perhaps with appropriate auto crop plugins.

1
  • I've tried these but none of the tolerance between 0 and 128 and bg settings (which were both a little ambigous for me btw in what they mean) do any good for my set of images. I didn't know PS have an auto-crop plugin but I don't have PS either. :)
    – n611x007
    Commented Jun 30, 2013 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .