Image.GetPropertyCount method

Applies to: desktop apps only

The Image::GetPropertyCount method gets the number of properties (pieces of metadata) stored in this Image object.

Syntax

UINT GetPropertyCount();

Parameters

This method has no parameters.

Return value

Type:

Type: UINT

This method returns the number of properties stored in this Image object.

Examples

The following example creates an Image object based on a JPEG file. The code calls the Image::GetPropertyCount method of that Image object to find out how many properties are stored in the image. Then the code calls the Image::GetPropertyIdList method to get a list of the property types.


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

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

   UINT count = 0; 
   Image* image = new Image(L"FakePhoto.jpg");

   // How many properties (pieces of metadata) are in the image?
   count = image->GetPropertyCount();
   if(count == 0)
      return 0;

   // Allocate a buffer to receive an array of PROPIDs.
   PROPID* propIDs = new PROPID[count];

   image->GetPropertyIdList(count, propIDs);

   // List the retrieved IDs.
   for(UINT j = 0; j < count; ++j)
      printf("%x\n", propIDs[j]);

   delete [] propIDs;
   delete image;   
   GdiplusShutdown(gdiplusToken);
   return 0;
}

The preceding code, along with a particular file, FakePhoto.jpg, produced the following output:


320
10f
110
9003
829a
5090
5091

The preceding output shows the hexadecimal value of each property identifier. You can look up those numbers in Gdiplusimaging.h and find out that they represent the following property tags.

Hexadecimal valueProperty tag
0x0320PropertyTagImageTitle
0x010fPropertyTagEquipMake
0x0110PropertyTagEquipModel
0x9003PropertyTagExifDTOriginal
0x829aPropertyTagExifExposureTime
0x5090PropertyTagLuminanceTable
0x5091PropertyTagChrominanceTable

 

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::GetAllPropertyItems
Image::GetPropertyIdList
Image::GetPropertyItem
Image::GetPropertyItemSize
Image::GetPropertySize
PropertyItem
Image::RemovePropertyItem
Image::SetPropertyItem
Reading and Writing Metadata

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: