This documentation is archived and is not being maintained.

BitmapDecoder.Create Method (Uri, BitmapCreateOptions, BitmapCacheOption)

Creates a BitmapDecoder from a Uri by using the specified BitmapCreateOptions and BitmapCacheOption.

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

public static BitmapDecoder Create(
	Uri bitmapUri,
	BitmapCreateOptions createOptions,
	BitmapCacheOption cacheOption


Type: System.Uri
The Uri of the bitmap to decode.
Type: System.Windows.Media.Imaging.BitmapCreateOptions
Identifies the BitmapCreateOptions for this decoder.
Type: System.Windows.Media.Imaging.BitmapCacheOption
Identifies the BitmapCacheOption for this decoder.


The bitmapUri is null.


The bitmapUri specifies a class ID of an unsupported format type.

The following example demonstrates how to use the Create(Uri, BitmapCreateOptions, BitmapCacheOption) method to create a decoder for a given image. The first BitmapFrame of the image is used as the source of an Image control.

BitmapDecoder uriBitmap = BitmapDecoder.Create(
   new Uri("sampleImages/waterlilies.jpg", UriKind.Relative),

// Create an image element;
Image uriImage = new Image();
uriImage.Width = 200;
// Set image source.
uriImage.Source = uriBitmap.Frames[0];

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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