1 BitmapImage myBitmapImage = new BitmapImage ( );
2 myBitmapImage . BeginInit ( );
3 myBitmapImage . UriSource = new Uri ( ImagePath , UriKind . Relative );
4 myBitmapImage . DecodePixelWidth = 200;
5 myBitmapImage . EndInit ( );
6 FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap ( );
7 newFormatedBitmapSource . BeginInit ( );
8 newFormatedBitmapSource . Source = myBitmapImage;
9 newFormatedBitmapSource . DestinationFormat = PixelFormats . Gray32Float;
10 newFormatedBitmapSource . EndInit ( );
11 Image myImage = new Image ( );
12 myImage . Width = 200;
13 //set image source
14 myImage . Source = newFormatedBitmapSource;