Alright so here's a good one for you guys.
Long story short I am trying to create a .bmp file out of a byte . Now I have code that will convert a byte  to an Image that I then save to a file, but this doesn't work. Why? Well because the header of the Bitmap has been altered. Originally a bitmap file has a header that is 54 bytes long, I however, have altered the header, adding an addition 4 bytes, altereing the "Offset number of bytes before image starts" 4 bytes (which originally is 54 bytes) to 58 bytes.
Okay so I have finally gotten this all worked out, the problem is when I loaded in the file I saved, I noticed the 4 extra bytes I added were missing from my header (I should point out I feel pretty confident that I am allowed to added these extra 4 bytes as I tweaked the header to support it).
With this problem I decided maybe I need to manually write all the bytes in my array to a file. This should work just fine as I have the complete header pre-built and everything else is good.
I have tried using items like "File.WriteAllBytes" and "File.ReadAllBytes", however this doesn't work. First of all the .BMP image that is saved won't display correctly (like view it in an image viewer, it complains it can't display it) and when I read it in, not only do I find my header missing from the file, I also find more bytes missing (specifically 0 values).
So my question is how can I write my Byte  byte for byte to a file I specify. Like a clean slate, I don't want any excess header data getting mixed in.
Thanks for any help
Edited 3 Years Ago by JorgeM: Moved to C#