I've read through several posts in the forums trying to resolve my issues with auto page size when scanning. So far nothing is working quite right.
I am using an Epson GT-S50 Scanner on a computer running Windows XP Pro SP2. The Scanner is using a TWAIN driver v3.61A. I am running the most current version of GdPicturePro (5.99011141) downloaded today.
Several features available via the UI report that they are not available when trying to use them without the UI. For Example:
TwainIsAutoSizeAvailable returns False, althougth there is an Auto-Size option in the UI that works very well.
TwainIsAutomaticBorderDetectionAvailable returns False
TwainIsAutomaticDiscardBlankPagesAvailable returns false, although there is an option for that in the UI
So far my main problem is with the Auto-Size as the subject of this topic implies.
I am working with your sample app: twain_sample from the vb.net sample folder and modifying the code for the Demo 1 button.
Adding the code: Call Imaging1.CropWhiteBorders() removes cleans up my image size vertically, but not horizontally. There is a gray border on both sides of the card. Using CropBlackBorders() and CropBordersEX() do not seem to allow me to remove they gray border.
My current code is as follows:
- Code: Select all
Dim nImageID As Integer
If Imaging1.TwainOpenDefaultSource() Then
InitScanConfig()
Imaging1.TwainSetCurrentResolution(200)
Imaging1.TwainSetCurrentPixelType(GdPicturePro5.TwainPixelType.TWPT_GRAY) ' Grayscale
Imaging1.TwainSetCurrentBitDepth(8)
Imaging1.TwainSetPaperSize(GdPicturePro5.TwainPaperSize.USLETTER)
nImageID = Imaging1.CreateImageFromTwain(Me.Handle.ToInt32)
If nImageID <> 0 Then
Call Imaging1.CropBlackBorders(5, 0)
Call Imaging1.CropWhiteBorders(5, 0)
Call Imaging1.CropBordersEX(5)
Call ApplyImageFilters(nImageID)
If chkPreview.CheckState = 1 Then Call DisplayNativeImage()
Call Imaging1.SaveAsJPEG(My.Application.Info.DirectoryPath & "\acquire.jpg", 90)
Call Imaging1.CloseImage(nImageID)
End If
Call Imaging1.TwainCloseSource()
MsgBox("Done !")
Else
MsgBox("can't open default source, twain state is: " & Trim(Str(Imaging1.TwainGetState)))
End If
Thanks for any help with this issue.
Neal.
