IWICFastMetadataEncoder interface (wincodec.h)

Exposes methods used for in-place metadata editing. A fast metadata encoder enables you to add and remove metadata to an image without having to fully re-encode the image.

Inheritance

The IWICFastMetadataEncoder interface inherits from the IUnknown interface. IWICFastMetadataEncoder also has these types of members:

Methods

The IWICFastMetadataEncoder interface has these methods.

 
IWICFastMetadataEncoder::Commit

Finalizes metadata changes to the image stream.
IWICFastMetadataEncoder::GetMetadataQueryWriter

Retrieves a metadata query writer for fast metadata encoding.

Remarks

A decoder must be created using the WICDecodeOptions value WICDecodeMetadataCacheOnDemand to perform in-place metadata updates. Using the WICDecodeMetadataCacheOnLoad option causes the decoder to release the file stream necessary to perform the metadata updates.

Not all metadata formats support fast metadata encoding. The native metadata handlers that support metadata are IFD, Exif, XMP, and GPS.

If a fast metadata encoder fails, the image will need to be fully re-encoded to add the metadata.

Examples

The following demonstrates how to obtain a fast metadata encoder from an image frame and use its query writer to write a metadata item.

IWICFastMetadataEncoder *pFME = NULL;
IWICMetadataQueryWriter *pFMEQW = NULL;

hr = pFactory->CreateFastMetadataEncoderFromFrameDecode(pFrameDecode, &pFME);

if (SUCCEEDED(hr))
{
 	hr = pFME->GetMetadataQueryWriter(&pFMEQW);
}

if (SUCCEEDED(hr))
{
	 // Add additional metadata
 	PROPVARIANT value;

	 PropVariantInit(&value);

 	value.vt = VT_UI2;
	 value.uiVal = 99;
 	hr = pFMEQW->SetMetadataByName(L"/app1/ifd/{ushort=18249}", &value);

 	PropVariantClear(&value);
}

if (SUCCEEDED(hr))
{
	 hr = pFME->Commit();
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h