qq_39112364 2017-11-10 06:34
浏览 2366
已结题

bitmapSource转换图片 这后面该如何写

static async Task GetThumbnail()
{
ClsVision vis = new ClsVision(VisionKey, VisionUri);
string imgSourcePath = @"D:\Image\2.jpg";
FileStream fs = File.OpenRead(imgSourcePath);
int imgLength = (int)fs.Length;
byte[] imgByte = new byte[imgLength];
fs.Read(imgByte, 0, imgLength);
fs.Close();
string imgData = Convert.ToBase64String(imgByte);
byte[] value = await vis.GetThumbnail(imgData,"800","600");
BitmapImage bitmapSource = new BitmapImage();
bitmapSource.BeginInit();
bitmapSource.CacheOption = BitmapCacheOption.None;
bitmapSource.StreamSource = new MemoryStream(value);
bitmapSource.EndInit();
这里该怎么写???????
Console.WriteLine(value);
}

  • 写回答

0条回答 默认 最新

    报告相同问题?