Export (0) Print
Expand All

InPlaceBitmapMetadataWriter Class

Enables in-place updates to existing blocks of BitmapMetadata. This class cannot be inherited.

Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public sealed class InPlaceBitmapMetadataWriter : BitmapMetadata
public final class InPlaceBitmapMetadataWriter extends BitmapMetadata
public final class InPlaceBitmapMetadataWriter extends BitmapMetadata
You cannot use this managed class in XAML.

If BitmapMetadata is not associated with a BitmapFrame that is obtained through a BitmapDecoder, the attempt to write metadata by using the in-place writer will fail. Successful write operations apply the metadata directly to the image stream by means of a decoder.

In-place metadata updates fail if an attempt is made to write metadata that a given bitmap format does not support.

To perform in-place metadata edits, the bitmap must be decoded using either the Default or OnDemand cache options. OnLoad does not guarantee access to the metadata stream needed for in-place metadata edits.

The following code example demonstrates how to use an InPlaceBitmapMetadataWriter to write metadata to a Portable Network Graphics (PNG) image.

Stream pngStream = new System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapFrame pngFrame = pngDecoder.Frames[0];
InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter();
if (pngInplace.TrySave() == true)
{ pngInplace.SetQuery("/Text/Description", "Have a nice day."); }
pngStream.Close();

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Freezable
         System.Windows.Media.ImageMetadata
           System.Windows.Media.Imaging.BitmapMetadata
            System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter

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

Community Additions

ADD
Show:
© 2014 Microsoft