简体   繁体   中英

How to convert BitmapImage into byte array in silverlight4?

I am trying to convert the BitmapImage into byte array, but not getting the exact solution. The Image.Save() method is not available in Silverlight Library. How to fix this?

if you image source is in the project you can use this..

var uri = new Uri("/ReferencedAssembly;component/default.png", UriKind.Relative);
var streamInfo = System.Windows.Application.GetResourceStream(uri);
var stream = streamInfo.Stream; 

convert the stream to bytes array..

if image is one some other location

Using httpwebrequest to get image from website to byte[]

Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM