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.RemovePropertyItem method

Applies to: desktop apps only

The Image::RemovePropertyItem method removes a property item (piece of metadata) from this Image object.

Syntax

Status RemovePropertyItem(
  [in]  PROPID propId
);

Parameters

propId [in]

Type: PROPID

Integer that identifies the property item to be removed.

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

The Image::RemovePropertyItem method removes a specified property from an Image object, but that property item is not removed from the file or stream that was used to construct the Image object. To save the image (with the property item removed) to a new JPEG file or stream, call the Save method of the Image object.

Examples

The following example creates an Image object based on a JPEG file. The code removes the PropertyTagEquipMake property item from the Image object by calling its Image::RemovePropertyItem method. The code calls Image::GetPropertyItemSize twice (once before and once after removing the item) to determine the size of the PropertyTagEquipMake property item. The code does not remove the property item from the image file; it removes the property item only from the Image object.


#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"FakePhoto3.jpg");
   UINT size = 0;

   size = image->GetPropertyItemSize(PropertyTagEquipMake);
   printf("The size of the PropertyTagEquipMake item is %u.\n", size);

   image->RemovePropertyItem(PropertyTagEquipMake);   

   size = image->GetPropertyItemSize(PropertyTagEquipMake);
   printf("The size of the PropertyTagEquipMake item is %u.\n", size);

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

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


The size of the PropertyTagEquipMake item is 33.
The size of the PropertyTagEquipMake item is 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::GetAllPropertyItems
Image::GetPropertyCount
Image::GetPropertyIdList
Image::GetPropertyItem
Image::GetPropertyItemSize
Image::GetPropertySize
PropertyItem
Image::SetPropertyItem
Reading and Writing Metadata

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show:
© 2014 Microsoft