图片转换的时候这段代码
有的时候会有问题 编码解码器无法使用提供的流类型 或者 The codec cannot use the type of stream provided
改成
BitmapImage
bitImage = new BitmapImage(); bitImage.BeginInit(); bitImage.StreamSource
= imageStreamSource; bitImage.EndInit(); //JpegBitmapDecoder
jpeDecoder=new JpegBitmapDecoder(imageStreamSource,BitmapCreateOptions.PreservePixelFormat,BitmapCacheOption.OnLoad); //ImageSource
imageSource=jpeDecoder.Frames[0]; ImageSource
imageSource = bitImage; return imageSource; |