Search found 11 matches

by mattj
2015-02-09T12:03:35-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Probably should be convert ( receipt.pdf[0--1] -colorspace gray -type grayscale -contrast-stretch 0 ) null: ( -clone 0--2 -colorspace gray -negate -lat 15x15+5% -contrast-stretch 0 ) -compose copy_opacity -layers Composite -fill "white" -opaque none +matte -deskew 40% -sharpen 0x1 receipt...
by mattj
2015-02-09T11:34:27-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Thanks snibgo! I had my null: in the wrong place and also the "-layers Composite" had to replace the "-composite" command that I had. So here's the final command: convert ( receipt.pdf[0--1] null: -colorspace gray -type grayscale -contrast-stretch 0 ) ( -clone 0--2 -colorspace gr...
by mattj
2015-02-08T18:38:18-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

fmw42 wrote:perhaps your IM version is too old for -layers composite. best to always provide your IM version and platform when asking a question. or perhaps it is not implemented yet in Magick.Net
Sorry, yes I'm on 6.9.0 on Windows.

So what I'm doing *should* work?
by mattj
2015-02-06T13:46:39-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

"-composite" works on two images (or three, including a mask). But you have many images, from the input pdf, plus all the clones. You might get around this with two lists separated by null: , or something. But if your pdf is large, you might run out of memory. A better strategy might be t...
by mattj
2015-02-06T12:59:58-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

So my command line process is working fine, but on multi-page pdf's it was only saving the first page. So I modified the initial grayscale conversion and clone and saved them individually to prove they are converting all the pages, and they are. However when it saves receipt_after.pdf after the -com...
by mattj
2015-01-07T05:48:41-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Awesome thanks!

And did you see my previous question yesterday about contrast stretch?
Is MagickImage.ContrastStretch(0,0) the equivalent of -contrast-stretch 0 ? MagickImage.ContrastStretch(0,0) seems to turn my image mostly white, while MagickImage.AutoLevel() seems to work much better.
by mattj
2015-01-06T14:13:20-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

The last parameter of AdaptiveThreshold should be 5% of the QuantumRange (Quantum.Max). I just submitted a patch to add an overload of AdaptiveThreshold that accepts a percentage. It also seems that there is a bug in ImageMagick 7. I tried the following in IM6 and IM7 and it produces different resu...
by mattj
2015-01-06T13:12:36-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Thanks again, making more progress. Is MagickImage.ContrastStretch(0,0) the equivalent of -contrast-stretch 0 ? MagickImage.ContrastStretch(0,0) seems to turn my image mostly white, while MagickImage.AutoLevel() seems to work much better. Can you see any reason that this //Create Mask MagickImage im...
by mattj
2015-01-05T14:22:46-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Thanks that did it. So I really need to use a technique more similar to Fred's TextCleaner and I'm looking at his sample of the ImageMagick command string. convert \( $infile -colorspace gray -type grayscale -contrast-stretch 0 \) \ \( -clone 0 -colorspace gray -negate -lat ${filtersize}x${filtersiz...
by mattj
2015-01-02T10:17:31-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Re: Clean Up a Document for Faxing/OCR

Hi, I've tried to recreate this from the previous post: MagickLevelImage(wand,0.0,0.25,MaxRGB); MagickNegateImage(wand,false); MagickAdaptiveThresholdImage(wand,30,30,10); MagickNegateImage(wand,false); as this in .NET: imgReceipt.AutoLevel(); imgReceipt.Negate(); imgReceipt.AdaptiveThreshold(30, 30...
by mattj
2015-01-02T07:29:50-07:00
Forum: Magick.NET
Topic: Clean Up a Document for Faxing/OCR
Replies: 25
Views: 41716

Clean Up a Document for Faxing/OCR

Hi All, I'm trying to clean up a document using the .NET library, where the image might have some darkess or color on the background. So I'd want to make the background white and improve the clarity of the text if possible. I've been trying to reproduce the commands from this post: http://www.imagem...