RasterImageBinarizeFixed Method |
Binarization of an image with predefined threshold
Namespace: Aspose.ImagingAssembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 22.05
Syntaxpublic virtual void BinarizeFixed(
byte threshold
)
Public Overridable Sub BinarizeFixed (
threshold As Byte
)
public:
virtual void BinarizeFixed(
unsigned char threshold
)
abstract BinarizeFixed :
threshold : byte -> unit
override BinarizeFixed :
threshold : byte -> unit
Parameters
- threshold
- Type: SystemByte
Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.
ExamplesThe following example binarizes a raster image with the predefined threshold. Binarized images contain only 2 colors - black and white.
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
rasterImage.BinarizeFixed(127);
rasterImage.Save(dir + "sample.BinarizeFixed.png");
}
See Also