shad0wk shad0wk - 1 year ago 92
C# Question

Saving a image that was converted into byte[] without System.Drawing?

Yes you can just use:

// A byte array that contains a .jpeg data.
System.IO.Stream BitmapStream = System.IO.MemoryStream(byteBuffer);
System.Drawing.Bitmap MyImage = System.Drawing.Bitmap.FromStream(BitmapStream);
MyImage.Save("C:\Folder\Folder\image.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);

But how could you do this without

I would like to write my own code to create the image.

Answer Source

If you have the image in bytes you don't need to use drawing to make an image, just save it as a binary file.

System.IO.File.WriteAllBytes("C:\Folder\Folder\image.png", byteBuffer);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download