VintaSoft Twain .NET SDK 15.0: Documentation for .NET developer
Vintasoft.Twain Namespace / Device Class / Threshold Property
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
    Threshold Property (Device)
    In This Topic
    Gets or sets the threshold of black-white images for current scan session.
    Syntax
    'Declaration
    
    Public Property Threshold As Single
    
    
    public float Threshold { get; set; }
    
    
    public: __property float get_Threshold();
    public: __property void set_Threshold(
    float value
    );
    public:
    property float Threshold { float get(); void set(float value); }
    Exceptions
    ExceptionDescription
    Thrown if device is in wrong state.
    Thrown if device does not support capability.
    Thrown if the .NET debugger is used and the function evaluation requires all threads to run.
    Remarks

    Call this property only when device is opened (State == DeviceState.Opened).

    Supported values of brightness can be received by the GetSupportedThresholdValues method.

    Example

    This C#/VB.NET code shows how to acquire black-white images from the device.

    
    Public Sub ScanBlackWhiteImageWithBitDepthReductionMode(device As Vintasoft.Twain.Device)
            device.ShowUI = False
            device.DisableAfterAcquire = True
    
            device.Open()
            device.PixelType = Vintasoft.Twain.PixelType.BW
            device.PixelFlavor = Vintasoft.Twain.PixelFlavor.Chocolate
            device.BitDepthReductionMode = Vintasoft.Twain.BitDepthReductionMode.Threshold
            device.Threshold = 128
            device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches
            device.Resolution = New Vintasoft.Twain.Resolution(200F, 200F)
    
            device.Acquire()
    End Sub
    
    
    
    public void ScanBlackWhiteImageWithBitDepthReductionMode(Vintasoft.Twain.Device device)
    {
        device.ShowUI = false;
        device.DisableAfterAcquire = true;
    
        device.Open();
        device.PixelType = Vintasoft.Twain.PixelType.BW;
        device.PixelFlavor = Vintasoft.Twain.PixelFlavor.Chocolate;
        device.BitDepthReductionMode = Vintasoft.Twain.BitDepthReductionMode.Threshold;
        device.Threshold = 128;
        device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
        device.Resolution = new Vintasoft.Twain.Resolution(200f, 200f);
    
        device.Acquire();
    }
    
    

    Requirements

    Target Platforms: .NET 8, .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also