Can anyone suggest a way to convert a 2352x1726x8bit greyscale BitmapSource
to Bitmap
that is faster than the following taking about 600ms on a 3.2GHz P4:
public static Bitmap toBitmap(this BitmapSource bitmapsource)
{
Bitmap bitmap;
using (MemoryStream stream = new MemoryStream())
{
// from System.Media.BitmapImage to System.Drawing.Bitmap
PngBitmapEncoder enc = new PngBitmapEncoder();
enc.Frames.Add(BitmapFrame.Create(bitmapsource));
enc.Save(stream);
bitmap = new System.Drawing.Bitmap(stream);
}
return bitmap;
}