Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize
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.GetAllPropertyItems method

Applies to: desktop apps only

The Image::GetAllPropertyItems method gets all the property items (metadata) stored in this Image object.

Syntax

Status GetAllPropertyItems(
  [in]   UINT totalBufferSize,
  [in]   UINT numProperties,
  [out]  PropertyItem *allItems
);

Parameters

totalBufferSize [in]

Type: UINT

Integer that specifies the size, in bytes, of the allItems buffer. Call the Image::GetPropertySize method to obtain the required size.

numProperties [in]

Type: UINT

Integer that specifies the number of properties in the image. Call the Image::GetPropertySize method to obtain this number.

allItems [out]

Type: PropertyItem*

Pointer to an array of PropertyItem objects that receives the property items.

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.

Remarks

Some image files contain metadata that you can read to determine features of the image. For example, a digital photograph might contain metadata that you can read to determine the make and model of the camera used to capture the image.

GDI+ stores an individual piece of metadata in a PropertyItem object. The Image::GetAllPropertyItems method returns an array of PropertyItem objects. Before you call Image::GetAllPropertyItems, you must allocate a buffer large enough to receive that array. You can call the Image::GetPropertySize method of an Image object to get the size, in bytes, of the required buffer. The Image::GetPropertySize method also gives you the number of properties (pieces of metadata) in the image.

Several enumerations and constants related to image metadata are defined in Gdiplusimaging.h.

Examples

The following example creates an Image object based on a JPEG file. The code calls the GetAllPropertyItems method of that Image object to obtain its property items (metadata).


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

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

   // Create an Image object based on a JPEG file.
   Image* image = new Image(L"FakePhoto.jpg"); 

   // Find out how many property items are in the image, and find out the
   // required size of the buffer that will receive those property items.
   UINT totalBufferSize;
   UINT numProperties;
   image->GetPropertySize(&totalBufferSize, &numProperties);

   // Allocate the buffer that will receive the property items.
   PropertyItem* pAllItems = (PropertyItem*)malloc(totalBufferSize);

   // Fill the buffer.
   image->GetAllPropertyItems(totalBufferSize, numProperties, pAllItems);

// Print the id data member of each property item.
   for(UINT j = 0; j < numProperties; ++j)
   {
      printf("%x\n", pAllItems[j].id);
   }

   free(pAllItems);
   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 a hexadecimal ID number for each property item. You can look up those ID 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::GetPropertyCount
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

Show:
© 2015 Microsoft