This documentation is archived and is not being maintained.

BitmapMetadata Class

Provides support for reading and writing metadata to and from a bitmap image.

Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public class BitmapMetadata : ImageMetadata, IEnumerable<string>, IEnumerable
public class BitmapMetadata extends ImageMetadata implements IEnumerable<String>, 
public class BitmapMetadata extends ImageMetadata implements IEnumerable<String>, 
You cannot use this managed class in XAML.

Metadata that is associated with an image is data that describes the image but is not necessary to display the image. Each supported bitmap image format handles metadata differently, but the facility for reading and writing metadata is the same.

Windows Presentation Foundation (WPF) supports the following image metadata schemas: Exchangeable image file (Exif), tEXt (PNG Textual Data), image file directory (IFD), International Press Telecommunications Council (IPTC), and Extensible Metadata Platform (XMP).

If a BitmapMetadata is exposed by a BitmapFrame that is obtained by using a BitmapDecoder, it is read-only by default and mutable operations will throw an exception. If it is exposed by a BitmapFrame that wraps another BitmapSource, it is mutable on construction.

The SetQuery and GetQuery methods can be used to construct and read metadata queries.

The following example demonstrates how to write metadata to a Tagged Image File Format (TIFF) image by using the IFD and Exif schemas.

BitmapMetadata tiffMetadata = new BitmapMetadata("tiff");
tiffMetadata.SetQuery("/ifd/{ushort=1000}", 9999);
tiffMetadata.SetQuery("/ifd/{uint=1001}", 23456);
tiffMetadata.SetQuery("/ifd/{uint=1002}", 34567);
tiffMetadata.SetQuery("/ifd/PaddingSchema:padding", (UInt32)4096);
tiffMetadata.SetQuery("/ifd/exif", new BitmapMetadata("exif"));
tiffMetadata.SetQuery("/ifd/exif/PaddingSchema:padding", (UInt32)4096);

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0