Is it possible in TWAIN to force a scanner to set the region to the entire width?

前端 未结 1 1177
忘掉有多难
忘掉有多难 2021-01-13 12:44

I am writing an application that requires scanning in .net (c# version 4.0, Visual Studio 2010). I\'m using the TWAIN API in order to

1条回答
  •  余生分开走
    2021-01-13 13:42

    So, in case anyone is interested I ended up giving up on TWAIN entirely - I think it is simply not possible.

    What I did instead was install:

    • Cygwin (basic install plus gcc-core, make and libusb-win32 packages)
    • libusb-win32
    • SANE.

    After a whole heap of configuring, making and installing I finally was able to issue this command from the Cygwin prompt:

    scanimage -t 30 -y 30 --mode Color --depth 8 --resolution 1200 --sharpness 2 --format=tiff --source TPU8x10 > out.tiff
    

    and would you believe it out.tiff was wide and sharp and a whole lot better than I could achieve with TWAIN.

    So, it is a horrible kludge I know, but I don't have a whole heap of options (it must be a windows, thick client application that runs on a machine with a scanner connected), so I just launch this:

    c:\cygwin\bin\bash.exe --login -c "scanimage -t 30 -y 30 --mode Color --depth 8 --resolution 1200 --sharpness 2 --format=tiff --source TPU8x10 > ~/out.tiff"
    

    via a Process in the .NET application and when it returns I load up the file into a Bitmap and carry on as if nothing freaky just happened (means the application has now a whole heap of extra prerequisites and fiddly configuration steps, but, well, meh, sue me).

    0 讨论(0)
提交回复
热议问题