shad0wk shad0wk - 8 months ago 44
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.


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);