3
有没有通过头文件或其他方式从* .bmp文件找到高度和宽度的方法?我目前正在使用Visual Studio 2010.我认识到头文件是54字节。使用C++的图像的高度和宽度
目前,我有这样的:
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 = new char[n];
//read data as a block:
image.read(res, n);
有没有一种方法,我可以循环通过提取相关信息?如果可能的话,我会很感激的。
在此先感谢。
我推荐为此使用一个库。 GOOGLE给了我这个:http://easybmp.sourceforge.net/ – Galik