GetWidth

Image.GetWidth method

Applies to: desktop apps only

The Image::GetWidth method gets the width, in pixels, of this image.

Syntax

UINT GetWidth();

Parameters

This method has no parameters.

Return value

Type:

Type: UINT

This method returns the width, in pixels, of this image.

Examples

The following console application creates an Image object based on a JPEG file. The code obtains the width of the image, in pixels, by calling the Image::GetWidth 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");
   UINT imageWidth = image->GetWidth();
   printf("The width of the image is %u.\n", imageWidth);

   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
Bitmap
Image::GetHeight
Image::GetHorizontalResolution
Image::GetVerticalResolution
Using Images, Bitmaps, and Metafiles
Images, Bitmaps, and Metafiles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2016 Microsoft