Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

BitmapDecoder.Frames Property

Gets the content of an individual frame within a bitmap.

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

public virtual ReadOnlyCollection<BitmapFrame> Frames { get; }

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<BitmapFrame>
An instance of BitmapFrame. This property has no default value.

Only Tagged Image File Format (TIFF) and Graphics Interchange Format (GIF) images support more than one frame.

Any BitmapFrame objects returned by this property are frozen.

The following code example demonstrates how to use a BitmapFrame as a BitmapSource.


// Open a Stream and decode a TIFF image
Stream imageStreamSource = new FileStream("tulipfarm.tif", FileMode.Open, FileAccess.Read, FileShare.Read);
TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];

// Draw the Image
Image myImage1 = new Image();
myImage1.Source = bitmapSource;
myImage1.Stretch = Stretch.None;
myImage1.Margin = new Thickness(20);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft