Skip to content

Latest commit

 

History

History
176 lines (115 loc) · 6.09 KB

nf-gdiplusheaders-image-getpropertyitemsize.md

File metadata and controls

176 lines (115 loc) · 6.09 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist req.product ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:gdiplusheaders.Image.GetPropertyItemSize
Image::GetPropertyItemSize (gdiplusheaders.h)
The Image::GetPropertyItemSize method gets the size, in bytes, of a specified property item of this Image object.
GetPropertyItemSize
GetPropertyItemSize method [GDI+]
GetPropertyItemSize method [GDI+]
Image class
Image class [GDI+]
GetPropertyItemSize method
Image.GetPropertyItemSize
Image::GetPropertyItemSize
_gdiplus_CLASS_Image_GetPropertyItemSize_propId_
gdiplus._gdiplus_CLASS_Image_GetPropertyItemSize_propId_
gdiplus\_gdiplus_CLASS_Image_GetPropertyItemSize_propId_.htm
gdiplus
VS|gdicpp|~\gdiplus\gdiplusreference\classes\imageclass\imagemethods\getpropertyitemsize.htm
12/05/2018
GetPropertyItemSize, GetPropertyItemSize method [GDI+], GetPropertyItemSize method [GDI+],Image class, Image class [GDI+],GetPropertyItemSize method, Image.GetPropertyItemSize, Image::GetPropertyItemSize, _gdiplus_CLASS_Image_GetPropertyItemSize_propId_, gdiplus._gdiplus_CLASS_Image_GetPropertyItemSize_propId_
gdiplusheaders.h
Gdiplus.h
Windows
Windows XP, Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdiplus.lib
Gdiplus.dll
Windows
GDI+ 1.0
19H1
Image::GetPropertyItemSize
gdiplusheaders/Image::GetPropertyItemSize
c++
APIRef
kbSyntax
COM
Gdiplus.dll
Image.GetPropertyItemSize

Image::GetPropertyItemSize

-description

The Image::GetPropertyItemSize method gets the size, in bytes, of a specified property item of this Image object.

-parameters

-param propId [in]

Type: PROPID

Integer that identifies the property item.

-returns

Type: UINT

This method returns the size, in bytes, of a specified property item of this Image object.

-remarks

The Image::GetPropertyItem method returns a PropertyItem object. Before you call Image::GetPropertyItem, you must allocate a buffer large enough to receive that object — the size varies according to data type and value of the property item. You can call the Image::GetPropertyItemSize method of an Image object to get the size, in bytes, of the required buffer.

Examples

The following example creates an Image object based on a JPEG file. The code calls the Image::GetPropertyItemSize method of that Image object to get the size of the property item that holds the make of the camera used to capture the image. Then the code calls the Image::GetPropertyItem method to retrieve that property item.

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

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

   UINT size = 0;
   PropertyItem* propertyItem = NULL;
   Image* image = new Image(L"FakePhoto.jpg");

   // Assume that the image has a property item of type PropertyItemEquipMake.
   // Get the size of that property item.
   size = image->GetPropertyItemSize(PropertyTagEquipMake);

   // Allocate a buffer to receive the property item.
   propertyItem = (PropertyItem*)malloc(size);

   // Get the property item.
   image->GetPropertyItem(PropertyTagEquipMake, size, propertyItem);

   // Display the members of the retrieved PropertyItem object.
   printf("The length of the property item is %u.\n", propertyItem->length);
   printf("The data type of the property item is %u.\n", propertyItem->type);

   if(propertyItem->type == PropertyTagTypeASCII)
      printf("The value of the property item is %s.\n", propertyItem->value);

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

The preceding code, along with a particular file, FakePhoto.jpg, produced the following output. Note that the data type is 2, which is the value of the PropertyTagTypeASCII constant that is defined in Gdiplusimaging.h.

The length of the property item is 17.
The data type of the property item is 2.
The value of the property item is Northwind Traders.

-see-also

Image

Image::GetAllPropertyItems

Image::GetPropertyCount

Image::GetPropertyIdList

Image::GetPropertyItem

Image::GetPropertySize

Image::RemovePropertyItem

Image::SetPropertyItem

PropertyItem

Reading and Writing Metadata