How to make Bitmap color transform to black-White , then Black-White convert to binary 01
The
PixelFormats class is used to represent image pixel formats. The class has
about 2 dozens of static properties representing various pixel formsts such as
BlackWhite, Gray16, Gray32Float, Gray8, Rgba64 and so on.
To
apply pixel formatting of an image, we use DestinationFormat property of
FormatConvertedBitmap. The Source property of FormatConvertedBitmap is the
original BitmapImage that you would like to convert to gray scale.
Listing
43 creates a FormatConvertedBitmap from a
BitmapImage and sets its DestinationFormat to Gray8.
privatevoid ConvertImageToGrayScaleImage()
{
// Create an
Image control
Image
grayImage = newImage();
// Create a
BitmapImage and sets its DecodePixelWidth and DecodePixelHeight
ery ferdianPosted May 13, 2011, 1:35 AM
How to make Bitmap color transform to black-White , then Black-White convert to binary 01