2
我需要读取一个jpg文件,latyer将它显示在Image控件中。 以下作品完美:WPF - 使用JpegBitmapDecoder将文件转换为Byte []到BitmapSource
imgTwo.Source = FetchImage(@"C:\Image075.jpg");
public BitmapSource FetchImage(string URLlink)
{
JpegBitmapDecoder decoder = null;
BitmapSource bitmapSource = null;
decoder = new JpegBitmapDecoder(new Uri(URLlink, UriKind.Absolute), BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
bitmapSource = decoder.Frames[0];
bitmapSource.Freeze();
return bitmapSource;
}
我的问题是,我需要保持这种形象在数据库中以字节](VARBINARY(MAX),并从那里读它,而不是直接从文件上做。 所以我需要要么有一个byte []作为输入这个功能,而不是URLlink串,或保存的BitmapSource作为字节[]。我该怎么办呢?
Det工作繁忙。非常感谢您的帮助。 :-) – Keren