bitmap转换为bitmapimage,本人用于qrcode的生成图片的转换
//bitmap转换bitmapimage
public BitmapImage bitTobitmapimage (Bitmap bmp)
{
BitmapImage image = new BitmapImage ();
MemoryStream ms = new MemoryStream ();
bmp.Save (ms,ImageFormat.Bmp);
image.BeginInit ();
image.StreamSource = ms;
image.EndInit ();
image.Freeze ();
return image;
}