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
Available since 3.0
Return to top
Show: