Saving a bitmap to a Memorystream produces an inverted colors image
- by Raphael
I've created an image with GDI+ on my application and now I must convert this image to an array of bytes.
My first thought was this simple code:
public byte[] ToByte()
{
MemoryStream ms = new MemoryStream();
bitmap.Save(ms, ImageFormat.Bmp);
return ms.GetBuffer();
}
The problem with this approach is that when I finally save this image into a file the colors are inverted. What I'm I doing wrong?