BitmapDecoder.Frames Property

Definition

Gets the content of an individual frame within a bitmap.

C#
public virtual System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Media.Imaging.BitmapFrame> Frames { get; }

Property Value

An instance of BitmapFrame. This property has no default value.

Examples

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

C#

// 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);

Remarks

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.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also