twain / twain-cs

A C# interface for TWAIN
172 stars 67 forks source link

Part of the scanned images obtained is corrupted #25

Open maciejsko opened 6 years ago

maciejsko commented 6 years ago

Some of the images I scan end up somehow corrupted - they are tilted to the side as if the pixels ware alligned incorrectly. I'm scanning using Fujitsu fi 7180 using adf and duplex, during one scanning sessions some of the pictures come out good, but some are tilted. Do You have any idea what could be the couse and where should i look for solution of this problem ?

twaindsm.log

img000001

bhagyesh18 commented 6 years ago

I am having same issue with IBML Scanner.

bhagyesh18 commented 6 years ago

Did you find any solution for this issue even i am also waiting from long time.

maciejsko commented 6 years ago

Unfortunately i couldn't find solution for this problem, but i found 'TwainDotNet' which worked for my purposes

yongqitao commented 6 years ago

我也遇到了这样的问题 大佬们有啥办法好解决的吗?

yongqitao commented 6 years ago

fujitsu fi7140

Mark1975 commented 5 years ago

I experienced the same problem with a different scanner. The transfer mechanism is MEMORY. I noticed the information returned by m_twain.DatImageinfo was incorrect in my case. When I moved the call to m_twain.DatImageinfo, so it is always called before m_twain.DatSetupmemxfer; I get consistently correct image information.

beckham12a18 commented 5 years ago

I experienced the same problem with a different scanner. The transfer mechanism is MEMORY. I noticed the information returned by m_twain.DatImageinfo was incorrect in my case. When I moved the call to m_twain.DatImageinfo, so it is always called before m_twain.DatSetupmemxfer; I get consistently correct image information.

Could you please provide more specific information about how to fix this issue. I've been experiencing this issue intermittently. The software has worked fine in most cases, but sometimes the scanned images got corrupted.

My scanner is fi-7180.

Thanks.

mattzirkle commented 5 years ago

I noticed that the twaincsscan test application skews the image, but when doing a NATIVE transfer with the TWAIN class it seems to work.

Mark1975 commented 5 years ago

I experienced the same problem with a different scanner. The transfer mechanism is MEMORY. I noticed the information returned by m_twain.DatImageinfo was incorrect in my case. When I moved the call to m_twain.DatImageinfo, so it is always called before m_twain.DatSetupmemxfer; I get consistently correct image information.

Could you please provide more specific information about how to fix this issue. I've been experiencing this issue intermittently. The software has worked fine in most cases, but sometimes the scanned images got corrupted.

My scanner is fi-7180.

Thanks.

In file TWAINCSTool.cs

just after the lines else if (m_twsxXferMech == TWAIN.TWSX.MEMORY) { Paste the following lines of code: sts = m_twain.DatImageinfo(TWAIN.DG.IMAGE, TWAIN.MSG.GET, ref twimageinfo); if (sts != TWAIN.STS.SUCCESS) { WriteOutput("ImageInfo failed: " + sts + Environment.NewLine); m_twain.Rollback(m_stateAfterScan); ReportImage("ScanCallback: 011.1", TWAIN.DG.IMAGE.ToString(), TWAIN.DAT.IMAGEINFO.ToString(), TWAIN.MSG.GET.ToString(), sts, null, null, null, null, 0); return (TWAIN.STS.SUCCESS); }

In my case, this solved the issue. I didn't submit this code, because I can't check if this fixes the problem for other users. (I only have a single scanner I can use to test).

beckham12a18 commented 5 years ago

Thanks all for your help.

I've tried using the NATIVE mode to see if it helps. If not, then I will try modifying the codes as suggested by Mark1975.

I will let you know the result.