I need to create a bitmap with a filestream. So far I have this Code:
using (FileStream bmp = File.Create(@"C:\test.bmp")) { BinaryWriter writer = new BinaryWriter(bmp); int i = 0; // writer.Write((char*)&fileheader, sizeof(fileheader)); // writer.Write((char*)&infoheader, sizeof(infoheader)); for (int rows = 0; rows < 160; rows++) { for (int cols = 0; cols < 112; cols++) { writer.Write(CamData[i]); i++; } } bmp.Close(); }
but I still need the header Informations for the bitmap. My Problem is, that I dont know how to implement they in C#. I know the resolution (320 x 240 ) and my pixeldata are 16 bit grayscale values given in a ushort array.
thanks