Using FJCore to encode Silverlight WriteableBitmap

前端 未结 3 949
走了就别回头了
走了就别回头了 2021-01-05 19:31

I am trying to find out how to use FJCore to encode a WriteableBitmap to a jpeg. I understand that WriteableBitmap provides the raw pixels but I am not sure how to convert i

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 19:35

    This code is fine and it should work. I am using same code to send image stream to server via web service and than regenerate image using these bytes...you can save these bytes to Db also

     [WebMethod]
     public string SaveImage(string data, string fileName)
     {
        byte[] imageBytes = System.Convert.FromBase64String(data);
    
        MemoryStream mem = new MemoryStream();
        mem.Write(imageBytes, 0, imageBytes.Length);
    
        System.Drawing.Image img = System.Drawing.Image.FromStream(mem);
        img.Save("D:\\FinalTest.jpg");      
        return "Saved !";
     }
    

提交回复
热议问题