I am trying to transfer some image image between Silverlight and WCF service. If possible, I would like to pass System.Windows.Media.Imaging.BitmapImage , as this would mean that the client does not need to do any transformations.
However, at some point I need to save this image in the database, that is, the image representation should be able to convert to and from byte[] . I can create a BitmapImage from byte[] by reading the array in a MemoryStream and using BitmapImage.SetSource() . But I canβt find a way to convert another path - from BitmapImage to byte[] . Did I miss something obvious here?
If this helps at all, the conversion code can be executed on the server, that is, it should not be safe for Silverlight.
c # bytearray silverlight bitmapimage
goric
source share