简体   繁体   English

如何检查图像是否正确转换为wp7中的字节数组

[英]How to check if an image is converted properly to byte array in wp7

Currently i'm sending my image as a byte[] to my server, but my server is constantly replying that "Image is not attached". 目前,我正在将图像作为字节[]发送到服务器,但是服务器一直在答复“未附加图像”。 So how can i check if the image is properly converted to byte array?? 那么如何检查图像是否正确转换为字节数组呢? This is the code i've used for converting the image to byte array, 这是我用于将图像转换为字节数组的代码,

using (MemoryStream ms1 = new MemoryStream())
            {
                WriteableBitmap btmMap = new WriteableBitmap(image);

                // write an image into the stream
                Extensions.SaveJpeg(btmMap, ms1,
                    image.PixelWidth, image.PixelHeight, 0, 100);

                // reset the stream pointer to the beginning
                ms1.Seek(0, 0);
                //read the stream into a byte array
                imageData = new byte[ms1.Length];
                ms1.Read(imageData, 0, imageData.Length);
            }

Could anyone tell me if it works coorectly or how to check if it is working properly. 谁能告诉我它是否工作正常,或者如何检查它是否正常工作。 Thanks in Advance!! 提前致谢!!

  1. Save it to file using FileStream 使用FileStream将其保存到文件
  2. Try to open the file. 尝试打开文件。 If it opens properly - the problem is on server side. 如果打开正确-问题出在服务器端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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