Finding Image dimensions of a png

Started by
-1 comments, last by Real World 20 years, 11 months ago
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!

This topic is closed to new replies.

Advertisement