尝试这个:
public void Load(string fileName)
{
using(Stream BitmapStream = System.IO.File.Open(fileName,System.IO.FileMode.Open ))
{
Image img = Image.FromStream(BitmapStream);
mBitmap=new Bitmap(img);
//...do whatever
}
}
或者,您可以执行以下操作( source ):
Bitmap myBmp = Bitmap.FromFile("path here");
0
我正在尝试从JPG提取BitmapImage。这是我的代码:
图像返回0×0图像,这当然意味着它不起作用。我该怎么做呢?