Hello all. Is there a way of finding the height and width from the *.bmp file either through its header file or another way? I'm currently using Visual Studio 2010. I recognise that the header file is 54 bytes.
ifstream image;
image.open("image.bmp",std::ios_base::binary);
if (image.is_open())
{
cout<< "function success\n";
}
else
{
cout<< "unable to open file";
}
//get length of file:
image.seekg(0, image.end);
int n = image.tellg();
image.seekg (0, image.beg);
//allocate memory:
char* res = newchar[n];
//read data as a block:
image.read(res, n);
Is there a way I can loop through to extract the relevant information? I would appreciate an example if possible.