I generated some BMP files with Arduino IDE , but they are only datas not a real BMP file , I know if I want to work the BMP file , the prerequisite is the header , I tried violence writing to the file , but it was failed!(As expected joke!)
Get down to business , how to insert BMP's header with Arduino IDE?
It will basically come down to writing bytes directly to the file in the right format, then writing the pixel data after that.
You'd need to read and understand the bitmap file format, I found Wikipedia to be good enough when I recently had to parse BMP files for a specific purpose:
For your purposes, you probably want to implement something like example 1 in the wikipedia article. Biggest change is figuring out what the header values need to be for RGB565 (16 bit) data (the usual used on Arduino) - the example shows RGB888 (24 bit) instead. At a guess, you will need to write out
Bitmap file header (14 bytes)
DIB header (version BITMAPINFOHEADER, 40 bytes), with compression BI_BITFIELDS and color depth 16