GdPicture.NET Reference Guide
FxBlackNWhiteT Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : FxBlackNWhiteT Method
GdPicture Image Identifier.
Value between [1 and 254] The default value is 128 which means '50%'.pixel lighter than 50% => become white, darker => become black.
Performs black & white effect on a GdPicture image or on an area of a GdPicture image defined by SetROI() method using a specific threshold value. Values above or equal to the threshold value will be set white, and values lower than the threshold value will be set as black.
Syntax
'Declaration
 
Public Function FxBlackNWhiteT( _
   ByVal ImageID As Integer, _
   ByVal Threshold As Byte _
) As GdPictureStatus
public GdPictureStatus FxBlackNWhiteT( 
   int ImageID,
   byte Threshold
)
public function FxBlackNWhiteT( 
    ImageID: Integer;
    Threshold: Byte
): GdPictureStatus; 
public function FxBlackNWhiteT( 
   ImageID : int,
   Threshold : byte
) : GdPictureStatus;
public: GdPictureStatus FxBlackNWhiteT( 
   int ImageID,
   byte Threshold
) 
public:
GdPictureStatus FxBlackNWhiteT( 
   int ImageID,
   byte Threshold
) 

Parameters

ImageID
GdPicture Image Identifier.
Threshold
Value between [1 and 254] The default value is 128 which means '50%'.pixel lighter than 50% => become white, darker => become black.

Return Value

A member of the GdPictureStatus enumeration.
Example
Applying black and white effect on the image using a threshold of 128.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   oGdPictureImaging.FxBlackNWhiteT(ImageID, 128)
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
SetROI Method
ResetROI Method
FxBlackNWhite(Int32,BitonalReduction) Method
ConvertTo1Bpp(Int32) Method