Export (0) Print
Expand All

InPlaceBitmapMetadataWriter Class

Enables in-place updates to existing blocks of BitmapMetadata.

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

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

public sealed class InPlaceBitmapMetadataWriter : BitmapMetadata

The InPlaceBitmapMetadataWriter type exposes the following members.

  NameDescription
Public propertyApplicationNameGets or sets a value that identifies the name of the application that was used to construct or alter an image file. (Inherited from BitmapMetadata.)
Public propertyAuthorGets or sets a value that represents the author of an image. (Inherited from BitmapMetadata.)
Public propertyCameraManufacturerGets or sets a value that identifies the camera manufacturer that is associated with an image. (Inherited from BitmapMetadata.)
Public propertyCameraModelGets or sets a value that identifies the camera model that was used to capture the image. (Inherited from BitmapMetadata.)
Public propertyCanFreezeGets a value that indicates whether the object can be made unmodifiable. (Inherited from Freezable.)
Public propertyCommentGets or sets a value that represents a comment that is associated with the image file. (Inherited from BitmapMetadata.)
Public propertyCopyrightGets or sets a value that indicates copyright information that is associated with the image file. (Inherited from BitmapMetadata.)
Public propertyDateTakenGets or sets a value that indicates the date that the image was taken. (Inherited from BitmapMetadata.)
Public propertyDependencyObjectTypeGets the DependencyObjectType that wraps the CLR type of this instance.  (Inherited from DependencyObject.)
Public propertyDispatcherGets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)
Public propertyFormatGets a value that identifies the format of the image. (Inherited from BitmapMetadata.)
Public propertyIsFixedSizeGets a value that determines whether the BitmapMetadata object is a fixed size. (Inherited from BitmapMetadata.)
Public propertyIsFrozenGets a value that indicates whether the object is currently modifiable. (Inherited from Freezable.)
Public propertyIsReadOnlyGets a value that indicates whether the metadata that is associated with an image is read-only. (Inherited from BitmapMetadata.)
Public propertyIsSealedGets a value that indicates whether this instance is currently sealed (read-only). (Inherited from DependencyObject.)
Public propertyKeywordsGets or sets a collection of keywords that describe the bitmap image. (Inherited from BitmapMetadata.)
Public propertyLocationGets a value that identifies the base location of the metadata that is associated with an image. (Inherited from BitmapMetadata.)
Public propertyRatingGets or sets a value that identifies the image rating. (Inherited from BitmapMetadata.)
Public propertySubjectGets or sets a value that indicates the subject matter of the bitmap image. (Inherited from BitmapMetadata.)
Public propertyTitleGets or sets a value that identifies the title of an image file. (Inherited from BitmapMetadata.)
Top

  NameDescription
Public methodCheckAccessDetermines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Public methodClearValue(DependencyProperty)Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)
Public methodClearValue(DependencyPropertyKey)Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)
Public methodCloneCreates a modifiable clone of this InPlaceBitmapMetadataWriter, making deep copies of this object's values. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.
Public methodCloneCurrentValueCreates a modifiable clone (deep copy) of the Freezable using its current values. (Inherited from Freezable.)
Public methodCoerceValueCoerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject. (Inherited from DependencyObject.)
Public methodContainsQueryDetermines whether a given query string exists within a BitmapMetadata object. (Inherited from BitmapMetadata.)
Public methodEqualsDetermines whether a provided DependencyObject is equivalent to the current DependencyObject. (Inherited from DependencyObject.)
Public methodFreeze()Makes the current object unmodifiable and sets its IsFrozen property to true. (Inherited from Freezable.)
Public methodGetAsFrozenCreates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Public methodGetCurrentValueAsFrozenCreates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Public methodGetHashCodeGets a hash code for this DependencyObject. (Inherited from DependencyObject.)
Public methodGetLocalValueEnumeratorCreates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)
Public methodGetQueryProvides access to a metadata query reader that can extract metadata from a bitmap image file. (Inherited from BitmapMetadata.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)
Public methodInvalidatePropertyRe-evaluates the effective value for the specified dependency property (Inherited from DependencyObject.)
Public methodReadLocalValueReturns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Public methodRemoveQueryRemoves a metadata query from an instance of BitmapMetadata. (Inherited from BitmapMetadata.)
Public methodSetCurrentValueSets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Public methodSetQueryProvides access to a metadata query writer that can write metadata to a bitmap image file. (Inherited from BitmapMetadata.)
Public methodSetValue(DependencyProperty, Object)Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Public methodSetValue(DependencyPropertyKey, Object)Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)
Protected methodShouldSerializePropertyReturns a value that indicates whether serialization processes should serialize the value for the provided dependency property. (Inherited from DependencyObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTrySaveGets a value that indicates whether image metadata can be saved successfully.
Public methodVerifyAccessEnforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Top

  NameDescription
Public eventChangedOccurs when the Freezable or an object it contains is modified. (Inherited from Freezable.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIEnumerable<String>.GetEnumeratorInfrastructure. For a description of this member, see IEnumerable<T>.GetEnumerator. (Inherited from BitmapMetadata.)
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorInfrastructure. For a description of this member, see IEnumerable.GetEnumerator. (Inherited from BitmapMetadata.)
Top

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.

This example shows how you can modify metadata within an image without having to re-encode the image. The following example uses an InPlaceBitmapMetadataWriter to write metadata into an 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();

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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