I have a byte[] of image data (of png type) and I want to convert it into jpeg type image. What would be the best way of doing it in Windows Phone 8?
Asked
Active
Viewed 133 times
-3
-
Check this link once.. http://stackoverflow.com/questions/8764280/c-sharp-image-to-byte-and-byte-to-image – Raghuveer Dec 03 '14 at 10:45
1 Answers
1
Try this:
using(var stream = new MemoryStream(bytes))
{
//bytes is byte[] containing the image data
var image = Image.FromStream(stream);
image.Save(File.OpenWrite("MyImage.jpeg", ImageFormat.Jpeg);
}

Ajay
- 6,418
- 18
- 79
- 130

Ricardo Peres
- 13,724
- 5
- 57
- 74
-
2
-
-
Also, do replace File.OpenWrite() for a new Stream, like MemoryStream, if you don't want to write the file to the filesystem. – Ricardo Peres Dec 03 '14 at 10:57
-
Seems like System.Drawing namespace is not available in WP8 and hence, we cannot do image.Save() – tavier Dec 03 '14 at 12:21