Small correction:
private static System.Drawing.Image ConvertImage(BitmapImage bmpThePage)
{
using (MemoryStream ms = new MemoryStream()) {
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmpThePage));
encoder.Save(ms);
return System.Drawing.Image.FromStream(ms);
}
}
You don't need parameters by
ref
. Input parameter is of reference type, and another one should be a return value. Also, I used
using
construct to dispose memory stream automatically. In this case Dispose will be called even on exception (you should always use this technique to initialize an instance of any class implementing
IDisposable
).
—SA