You can fill in the colour data for a BitmapSource like this:
PixelFormat pf = PixelFormats.Bgr24;
int rawStride = (width * pf.BitsPerPixel + 7) / 8;
byte[] rawImage = new byte[rawStride * height];
int rgbIndex = 0;
for (int lineIndex = 0; lineIndex < height; lineIndex++)
{
int lineStart = lineIndex * rawStride;
for (int pixelIndex = 0; pixelIndex < width; pixelIndex++)
{
rawImage[lineStart++] = (byte)(br.ReadByte());
rawImage[lineStart++] = (byte)(br.ReadByte());
rawImage[lineStart++] = (byte)(br.ReadByte());
}
}
image = BitmapSource.Create(width, height, 96, 96, pf, null, rawImage, rawStride);
Not knowing what format the raw data is in I can not advise you on the correct way to read the file. The code above assumes the data is stored RGBRGB..etc with no gaps anywhere.