Silverlight: image to byte[]

前端 未结 3 1479
遇见更好的自我
遇见更好的自我 2020-12-03 13:08

I\'m able to convert a byte[] to an image:

byte[] myByteArray = ...;  // ByteArray to be converted

MemoryStream ms = new MemoryStream(my);
BitmapImage bi =          


        
3条回答
  •  醉梦人生
    2020-12-03 13:29

    There is no solution that works in Silverlight by design. Images can be retrieved without the need to conform to any cross domain access policy as other http requests have to. The basis of this relaxation of the cross domain rules is that the data making up the image cannot be be retrieved in the raw. It can only be used as an image.

    If you want to simply write to and read from a bitmap image use the WriteableBitmap class instead of BitmapImage. The WriteableBitmap exposes a Pixels property not available on the BitmapImage.

提交回复
热议问题