silverlight base64编码 Image

将经Base64编码后的位图(png、jpg)字符串重新还原成图片显示:

 

public class PhotoConverter

      {        

         public BitmapImage PhotoConvert(string value)       

        {           

              byte[] imageBytes = Convert.FromBase64String(value.ToString());        

              BitmapImage bi = new BitmapImage();          

              bi.SetSource(new MemoryStream(imageBytes));     

              return bi;       

       }     

    }

posted @ 2012-02-23 14:51  liancs  阅读(143)  评论(0编辑  收藏  举报