BitmapEncoder Class
Encodes a collection of BitmapFrame objects to an image stream.
Assembly: PresentationCore (in PresentationCore.dll)
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 Windows Presentation Foundation Partial Trust Security for information on partial trust.
The following example demonstrates how to use the derived TiffBitmapEncoder class to encode an image.
Dim stream As New FileStream("empty.tif", FileMode.Create) Dim encoder As New TiffBitmapEncoder() Dim myTextBlock As New TextBlock() myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString() encoder.Frames.Add(BitmapFrame.Create(image)) MessageBox.Show(myPalette.Colors.Count.ToString()) encoder.Save(stream)
System.Windows.Threading.DispatcherObject
System.Windows.Media.Imaging.BitmapEncoder
System.Windows.Media.Imaging.BmpBitmapEncoder
System.Windows.Media.Imaging.GifBitmapEncoder
System.Windows.Media.Imaging.JpegBitmapEncoder
System.Windows.Media.Imaging.PngBitmapEncoder
System.Windows.Media.Imaging.TiffBitmapEncoder
System.Windows.Media.Imaging.WmpBitmapEncoder
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.