Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-04

Almost... ;) working WIA scanning code

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

Hi list,

Using the activex importer, I've imported the WIA wiaaut.dll on my Windows 7 system and mostly got WIA scanning (using a flatbed scanner in my case) to work. Thanks to Marco for helping me get this far. The code selects the first scanner, scans while showing the progress dialog and saves the result as a file.

What doesn't work:
Scanning the entire surface; only part of the image is scanned right now. Fairly essential requirement I'd say ;)

Setting the driver to black and white works, but I can't seem to request
both black and white and maximum quality:
    InVar:=wiaCurrentIntent; //what type of image we want to sacn
    //todo: this won't work gives invalid parameter!!
    //InVar2:=(WIA_INTENT_IMAGE_TYPE_TEXT or
WIA_INTENT_MAXIMIZE_QUALITY); // black & white; good quality for given
resolution
    InVar2:=WIA_INTENT_IMAGE_TYPE_TEXT;
    SetScannerProperty(Invar,Invar2);

Source code:
https://bitbucket.org/reiniero/papertiger/src
wiademo.lpr and associated units
Demo project source also downloadable via the download page.

Anyway, suggestions, critique etc welcome as always,

Regards,
Reinier

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 28 lines
Hi list, Using the activex importer, I've imported the WIA wiaaut.dll on my Windows 7 system and mostly got WIA scanning (using a flatbed scanner in my case) to work. Thanks to Marco for helping me get this far. The code selects the first scanner, scans while showing the progress dialog and saves the result as a file. What doesn't work: Scanning the entire surface; only part of the image is scanned right now. Fairly essential requirement I'd say ;) Setting the driver to black and white works, but I can't seem to request both black and white and maximum quality: InVar:=wiaCurrentIntent; //what type of image we want to sacn //todo: this won't work gives invalid parameter!! //InVar2:=(WIA_INTENT_IMAGE_TYPE_TEXT or WIA_INTENT_MAXIMIZE_QUALITY); // black & white; good quality for given resolution InVar2:=WIA_INTENT_IMAGE_TYPE_TEXT; SetScannerProperty(Invar,Invar2); Source code: https://bitbucket.org/reiniero/papertiger/src wiademo.lpr and associated units Demo project source also downloadable via the download page. Anyway, suggestions, critique etc welcome as always,

I'm guessing this will not work on Linux, right ? ;-)

Michael.

Reply by email

Reinier Olislagers
to Michael Van Canneyt
Michael Van Canneyt wrote 37 lines
On Tue, 15 Apr 2014, Reinier Olislagers wrote: > Hi list, > > Using the activex importer, I've imported the WIA wiaaut.dll on my > Windows 7 system and mostly got WIA scanning (using a flatbed scanner in > my case) to work. Thanks to Marco for helping me get this far. > The code selects the first scanner, scans while showing the progress > dialog and saves the result as a file. > > What doesn't work: > Scanning the entire surface; only part of the image is scanned right > now. Fairly essential requirement I'd say ;) > > Setting the driver to black and white works, but I can't seem to request > both black and white and maximum quality: > InVar:=wiaCurrentIntent; //what type of image we want to sacn > //todo: this won't work gives invalid parameter!! > //InVar2:=(WIA_INTENT_IMAGE_TYPE_TEXT or > WIA_INTENT_MAXIMIZE_QUALITY); // black & white; good quality for given > resolution > InVar2:=WIA_INTENT_IMAGE_TYPE_TEXT; > SetScannerProperty(Invar,Invar2); > > Source code: > https://bitbucket.org/reiniero/papertiger/src > wiademo.lpr and associated units > Demo project source also downloadable via the download page. > > Anyway, suggestions, critique etc welcome as always, I'm guessing this will not work on Linux, right ? ;-) Michael.

You guess correctly...
For my papertiger OCR project I just call the sane command on Linux or you could use bindings, see e.g.
https://code.google.com/p/ocrivist/

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 16 lines
>> Source code: >> https://bitbucket.org/reiniero/papertiger/src >> wiademo.lpr and associated units >> Demo project source also downloadable via the download page. >> >> Anyway, suggestions, critique etc welcome as always, > > I'm guessing this will not work on Linux, right ? ;-) > > Michael. > You guess correctly... For my papertiger OCR project I just call the sane command on Linux or you could use bindings, see e.g. https://code.google.com/p/ocrivist/

Sounds like the sane thing to do ;-)

Michael.

Reply by email

Reinier Olislagers
to Michael Van Canneyt
Michael Van Canneyt wrote 7 lines
On Tue, 15 Apr 2014, Reinier Olislagers wrote: > You guess correctly... > For my papertiger OCR project I just call the sane command on Linux or > you could use bindings, see e.g. > https://code.google.com/p/ocrivist/ Sounds like the sane thing to do ;-)

Considerable less mentally impairing than messing around with WIA on Windows anyway... ;)

I got it to sort of scan an A4 page... Updated source code and download for the *cough* eager hordes of readers ;)

Reply by email