I start out with a 128 x 128 array of doubles and turn that into a 1D array of bytes with proportional values for each double.
I then take this array of bytes and turn it into a memory stream (dataStream
below) and try and put that into a BitmapImage
like so:
imgScan.Width = 128;
imgScan.Height = 128;
BitmapImage bi = new BitmapImage();
bi.SourceRect = new Int32Rect(0, 0, width, height);
bi.StreamSource = dataStream;
imgScan.Source = bi;
Here imgScan
is a System.Windows.Controls.Image
This doesn't produce the expected image (I just get a white square).
How should I be going about this?