VintaSoftTwain Control v6.0
VintaSoftTwain Object / AcquiredImages_IsBlank Method
Zero-based index of image in acquired image collection. Valid values are from 0 to (AcquiredImages_Count-1).
Maximal possible value of noise in image in percents. Optimal value is 0.01 (%).
Current noise value in image. This value will be set after execution of the method.
In This Topic
    AcquiredImages_IsBlank Method
    In This Topic
    Description
    Determines that this image is a blank image.
    Syntax
    Visual Basic
    Public Function AcquiredImages_IsBlank( _
       ByVal index As Long, _
       ByVal maxNoiseLevel As Single, _
       ByRef currentNoiseLevel As Single _
    ) As Boolean
    Parameters
    index
    Zero-based index of image in acquired image collection. Valid values are from 0 to (AcquiredImages_Count-1).
    maxNoiseLevel
    Maximal possible value of noise in image in percents. Optimal value is 0.01 (%).
    currentNoiseLevel
    Current noise value in image. This value will be set after execution of the method.
    Return Type
    TRUE (1) if image is blank, FALSE (0) otherwise.
    Remarks
    Information about error that occurs during method execution can be get using the Error and ErrorString properties.
    Example
    This example shows how to check if scanned image is blank.
    Private VSTwain1 As New VintaSoftTwain()
    
    
    ''' <summary>
    ''' Scans images asynchronously.
    ''' </summary>
    Private Sub StartScan()
        ' open the device manager
        If Not VSTwain1.DeviceManager_Open() Then
            Console.WriteLine(VSTwain1.errorString)
            Exit Sub
        End If
    
        ' select device using standard device selection dialog
        VSTwain1.DeviceManager_ShowDefaultDeviceSelectionDialog()
    
        ' specify that device UI must be shown
        VSTwain1.Device_ShowUI = True
    
        ' subscribe to the device events
        AddHandler VSTwain1.DeviceImageAcquired, AddressOf VSTwain1_ImageAcquired
        AddHandler VSTwain1.DeviceScanCompleted, AddressOf VSTwain1_ScanCompleted
        AddHandler VSTwain1.DeviceScanFailed, AddressOf VSTwain1_ScanFailed
        AddHandler VSTwain1.DeviceScanCanceled, AddressOf VSTwain1_ScanCanceled
    
        ' acquire images asynchronously
        VSTwain1.Device_AcquireImage()
    End Sub
    
    Private Sub VSTwain1_ImageAcquired()
        ' get index of acquired image
        Dim imageIndex As Integer = VSTwain1.AcquiredImages_Count - 1
    
        Dim currentNoiseLevel As Single
        ' if image is blank
        If VSTwain1.AcquiredImages_IsBlank(imageIndex, 0.01, currentNoiseLevel) Then
            Console.WriteLine("Image is blank.")
        Else
            If currentNoiseLevel = 100 Then
                Console.WriteLine("Image is not blank. " + VSTwain1.errorString)
            Else
                Console.WriteLine("Image is not blank. Noise level is " + Str(currentNoiseLevel) + "%")
            End If
        End If
    End Sub
    
    Private Sub VSTwain1_ScanCompleted()
        Console.WriteLine("Scan is completed.")
    End Sub
    
    Private Sub VSTwain1_ScanFailed(errorString As String)
        Console.WriteLine(String.Format("Scan is failed: {0}.", errorString))
    End Sub
    
    Private Sub VSTwain1_ScanCanceled()
        Console.WriteLine("Scan is canceled.")
    End Sub
    See Also