VintaSoft Twain .NET SDK Discussions

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Board index < VintaSoft Twain < VintaSoft Twain .NET SDK Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

detect document size after scanning



detect document size after scanning

Post by placentiusz »

It is possible to detect document size after scanning or durring scan?
I use microtek ScanMaker 5950 Twain 1.9 scanner.


Re: detect document size after scanning

Post by Alex »

Hello,

What do you mean as "detect document size after scanning"? Do you want to detect document border automatically? If yes, you can use the DetectImageBorder method.

Here is a snippet of code:
Imports VintaSoft.Twain
...
Private Sub ProcessImageButton_Click(ByVal sender As System.Object, _
                 ByVal e As System.EventArgs) Handles BProcessImage.Click
    ...
    Try
        VSTwain1.DespeckleImage(imageNum, 8, 25, 30, 400)
        VSTwain1.DeskewImage(imageNum,BorderColor.AutoDetect, 5, 5)
        VSTwain1.DetectImageBorder(imageNum, 5, 5, 5)
        If Not PictureBox1.Image Is Nothing Then
            PictureBox1.Image.Dispose()
            PictureBox1.Image = Nothing
        End If
        LabelImageNum.Text = "Image " + CStr(imageNum) + _
                         " (" + CStr(VSTwain1.GetImageWidth(imageNum)) + _
                         " x " + CStr(VSTwain1.GetImageHeight(imageNum)) + _
                         " x " + CStr(VSTwain1.GetImageBPP(imageNum)) + " bpp)"
        PictureBox1.Image = VSTwain1.GetImage(imageNum)
    Catch ex As ImagingException
        MsgBox ex.Message
    End Try
    ...
End Sub

Private Sub VSTwain1_ProgressChanged(ByVal sender As Object, _
                       ByVal e As VintaSoft.Twain.ProgressChangedEventArgs) _
                       Handles VSTwain1.ProgressChanged
    Select Case e.Action
        Case Action.Deskew
            txtAction.Text = "Deskewing..."
        Case Action.Despecle
             txtAction.Text = "Despeckling..."
        Case Action.BorderDetection
            txtAction.Text = "Border detecting..."
        Case Action.Rotation
            txtAction.Text = "Rotating..."
        Case Action.ImageScan
            txtAction.Text = "Image scan..."
    End Select
    progressBar1.Value = e.PercentComplete
    e.Interrupt = bFinishFlag
End Sub
...
Please read more info in the documentation.

Best regards, Alexander


Page 1 from 1: 1