Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Image.GetPhysicalDimension method

Applies to: desktop apps only

The Image::GetPhysicalDimension method gets the width and height of this image.

Syntax

Status GetPhysicalDimension(
  [out]  SizeF *size
);

Parameters

size [out]

Type: SizeF*

Pointer to a SizeF object that receives the width and height of this image.

Return value

Type:

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following console application creates an Image object based on a JPEG file. The code obtains the width and height of the image by calling the Image::GetPhysicalDimension method.


#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   Image* image = new Image(L"Crayons.jpg");
   SizeF size;
   image->GetPhysicalDimension(&size);
   printf("The width of the image is %f.\n", size.Width);
   printf("The height of the image is %f.\n", size.Height);

   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Image
Image::GetBounds
Image::GetHeight
Image::GetHorizontalResolution
Image::GetVerticalResolution
Image::GetWidth
Cropping and Scaling Images
Improving Performance by Avoiding Automatic Scaling
Cropping and Scaling Images

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show:
© 2014 Microsoft