Process scanned image; Threshold; Antialias

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Gerenuk

Process scanned image; Threshold; Antialias

Post by Gerenuk »

I want to process a scanned imaged with black and white block adjusted text.

Which is the best command to set thresholds (i.e. reduce text from the opposite page shining through)?

Next I'd also like to add some artificial antialiasing for the letters that are already pixels. Which is the best command for that?

And finally I need to get the text centered on a A4 page (equal margins). I suppose I have to use another tool for that. Any suggestions?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Process scanned image; Threshold; Antialias

Post by fmw42 »

can you post a link to an example image. it is hard to tell what your issues might be for thresholding, etc.
Gerenuk

Re: Process scanned image; Threshold; Antialias

Post by Gerenuk »

I'm trying to get a good picture out of files like
Image

I played around with gimp, but ended up with inconsistent manipulations and looks. Also it tend to be quite high contrast and ugly letters so I hoped it would be possible to antialias somehow.

Btw: I discovered -deskew which was rly helpful.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Process scanned image; Threshold; Antialias

Post by fmw42 »

If you are on Linux or Mac (Unix), then you might want to try my script, textcleaner. See link below
Gerenuk

Re: Process scanned image; Threshold; Antialias

Post by Gerenuk »

Thanks a lot! I'll look at the script. I guess there are parameters to play around.
Could you guess the order of commands (just names, no parameters) which I will going to need?

Since you have dealt with text processing: how would suggest to center the block text on a standard A4 page? My best guess was to somehow mark the text boundary by hand (some special box in gimp?) and then place this image on a clean A4 page.
Gerenuk

Re: Process scanned image; Threshold; Antialias

Post by Gerenuk »

Btw, my next challenge will be to add these images in full 300dpi into a PDF. Is there any way to save space while doing that? (special option, have lineart only, ...)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Process scanned image; Threshold; Antialias

Post by fmw42 »

Gerenuk wrote:Thanks a lot! I'll look at the script. I guess there are parameters to play around.
Could you guess the order of commands (just names, no parameters) which I will going to need?

Since you have dealt with text processing: how would suggest to center the block text on a standard A4 page? My best guess was to somehow mark the text boundary by hand (some special box in gimp?) and then place this image on a clean A4 page.
In my script textcleaner, you can unrotate. Then take the output and use -extent to pad out to your A4 pixel size. You could also create an white A4 page and then composite the result from the script into the center. I don't know much about setting page sizes in those formats. But see http://www.imagemagick.org/script/comma ... s.php#page it will tell you the corresponding pixel dimensions.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Process scanned image; Threshold; Antialias

Post by fmw42 »

Gerenuk wrote:Btw, my next challenge will be to add these images in full 300dpi into a PDF. Is there any way to save space while doing that? (special option, have lineart only, ...)
I don't know much about PDF optimization. See http://www.imagemagick.org/Usage/formats/#pdf

If your images are line art in b/w, then you might want to convert your images to -type grayscale or -type bilevel before converting to PDF.
Post Reply