#### Archived

This topic is now archived and is closed to further replies.

# Finding Image dimensions of a png

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi Anyone know how to find the width and height of a png file loaded into a program at run time. Im using DX8.1 and C++ if that helps I know this works for a Bitmap...
BITMAP Bitmap;

HBITMAP hBitmap;

// Load the bitmap first using the GDI to get info about it
hBitmap = (HBITMAP)LoadImage( NULL, filenameOn, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION );
if( hBitmap == NULL )
{
// The file probably does not exist

LogError( "Unable to load bitmap" );
return E_FAIL;
}

// Get information about the object
GetObject( hBitmap, sizeof( BITMAP ), &Bitmap );
// Unload the bitmap from memory
DeleteObject( hBitmap ); 
But is there something similar [or easier] for a png file Cheers Planetblaze.com - http://www.planetblaze.com - As METAL as it gets!

• 10
• 11
• 11
• 10
• 12