Creating bitmap and storing on SD

I would like to create a new 24-bit .bmp file and save it to the SD card connected to Arduino TFT LCD.

I have the required header information and a 2D array containing the RGB value of each pixel. I am unable to figure out how to start with creating a new .bmp file and how to populate its header and pixel data with my header data and pixel data.

Are there any specific methods for dealing with bitmaps? Which libraries do I need to include? I'm aware of how to get a .bmp displayed over the Arduino TFT. I'm quite clueless regarding creating the bitmap.

Easiest is to design on PC and save as bitmap on SD card. Next move SD card to Arduino. Second easiest (I think) is to design and save the bitmap on PC and next send the file to the Arduino (e.g. using serial and a proper terminal program, network etc) and the Arduino will store on the SD card.

But I guess that's not why you're asking. Can you provide a little more detail? E.g. is it the Arduino that has to do the heavy lifting? If so, why?

sterretje: But I guess that's not why you're asking. Can you provide a little more detail? E.g. is it the Arduino that has to do the heavy lifting? If so, why?

I'm Sorry for not providing enough information. Yes the making of .bmp has to be done through Arduino itself. I'm trying to make a camera system which is not connected to a computer system for achieving its functions. It has to work similar to a digital camera. I have connected an imaging sensor and a tft lcd to my Arduino Due. So basically the image data received from imaging sensor has been processed. Now I need to put up this processed data into a .bmp file, save this new file on the SD and display this .bmp file on the Arduino TFT LCD.

If you know the data format required in the file, surely available on the Web, and have the data then where are you stuck ?

Open the file to write, write the data, close the file

UKHeliBob: If you know the data format required in the file, surely available on the Web, and have the data then where are you stuck ?

I'm struggling with finding the right instructions in arduino IDE to populate data. I need to write RGB values for each pixel of the bitmap. what is the specific instruction to do that. what are instructions to populate the header? how to give a name to the bitmap?

So you have a header. No idea what is in there but one way of writing

// this assumes a 32 byte header; no idea
byte  header[32];
for(int cnt=0;cnt<sizeof(header);cnt++)
{
  someFile.write(header[cnt]);
}

To name a file, studying the SD examples sounds like a good idea.

As suggested, try the examples with the SD library.

They will show you how to create a named file by opening it, write to it and close it when finished.

Just out of interest, what is the format of the header and the RGB data that you need to write ?