This documentation is archived and is not being maintained.

BitmapEncoder Class

Encodes a collection of BitmapFrame objects to an image stream. This is an abstract class.

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

public abstract class BitmapEncoder : DispatcherObject
public abstract class BitmapEncoder extends DispatcherObject
public abstract class BitmapEncoder extends DispatcherObject
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.

A derived codec may also provide support for specialized encoding properties, which are used to determine how a bitmap is encoded. For example, a codec may support specialized compression routines or interlacing of an encoded image.

You can specify multiple frames for any derived encoder, even if the bitmap format only supports one frame. In this case, only the first frame is saved.

The collection of frames can be encoded one at a time to any number of file streams.

Encoding does not work in partial trust. See the Windows Presentation Foundation Partial Trust Programming topic for information on partial trust.

The following example demonstrates how to use the derived TiffBitmapEncoder class to encode an image.

FileStream stream = new FileStream("empty.tif", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();

       Derived Classes

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0