Jump to content
  • Advertisement

Archived

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

Real World

Finding Image dimensions of a png

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

If you intended to correct an error in the post then please contact us.

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!

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!