I am wanting to find the dimensions of a image quickly. Now I know that there is a BITMAPFILEHEADER structure which can allow me to read the portion of the bitmap I want to read to get the width and height of the image.
// sBMPFileName is the BMP filename
if( !file.Open( sBMPFileName, CFile::modeRead) )
// Read file header
if (file.Read((LPSTR)&bmfHeader, sizeof(bmfHeader)) != sizeof(bmfHeader))
// File type should be 'BM'
if (bmfHeader.bfType != ((WORD) ('M' << 8) | 'B'))
if (file.Read((LPSTR)&bmiHeader, sizeof(bmiHeader)) != sizeof(bmiHeader))
int bmWidth = bmiHeader.biWidth;
int bmHeight = bmiHeader.biHeight;
I want to be able to do this for all images. I have potentially thousands of images and the system need to perform an add of an image size e.g. 6x4" print from the file. I want to make sure that the image is off sufficient quality to allow reasonable printing quality.
Is there something similar to this in mfc / gdi+ to do the same thing for all image types .... jpg, bmp, tiff, pcx.