VintaSoftTwain Control v6.0
VintaSoftTwain Object / Device_ImagePixelFlavor Property
In This Topic
    Device_ImagePixelFlavor Property
    In This Topic
    Gets or sets the value of pixel flavor for current scan session.
    Property type
    Read-write property
    Visual Basic
    Public Property Device_ImagePixelFlavor As Long
    Return Type
    The value of pixel flavor for current scan session.

    Valid values:
    Value Pixel flavor
    0 Chocolate. Zero pixel represents darkest shade.
    1 Vanilla. Zero pixel represents lightest shade.
    Call this property after Device_Open and before Device_AcquireImage.

    You can get supported values of page sizes by Device_GetSupportedResolutions method.

    This property has effect only for black-white images (Device_ImagePixelType == enumDevice_ImagePixelType.BW) and if User Interface is not used (Device_ShowUI=False).

    Information about error that occurs during getting/setting property value can be get using the Error and ErrorString properties.
    This example shows how to set pixel type, pixel flavor, image resolution and acquire images from the device.
    Private VSTwain1 As New VintaSoftTwain()
    Private Sub ScanImages()
        ' open the device manager
        If Not VSTwain1.DeviceManager_Open() Then
            Exit Sub
        End If
        ' open the device
        If Not VSTwain1.Device_Open Then
            Exit Sub
        End If
        ' scan images without UI
        VSTwain1.Device_ShowUI = False
        ' set the pixel type of acquired images
        VSTwain1.Device_ImagePixelType = PIXELTYPE.PIXELTYPE_RGB
        ' set the pixel flavor of acquired images
        VSTwain1.Device_ImagePixelFlavor = 0
        ' 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
    End Sub
    Private Sub VSTwain1_ImageAcquired()
        ' get index of acquired image
        Dim imageIndex As Integer = VSTwain1.AcquiredImages_Count - 1
        ' save acquired image to TIFF file
        If Not VSTwain1.AcquiredImages_Save(imageIndex, "test.tif") Then
        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