PngBitmapEncoder Constructor ()

 

Initializes a new instance of the PngBitmapEncoder class.

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

[SecurityCriticalAttribute]
public PngBitmapEncoder()

The following example demonstrates how to initialize a PngBitmapEncoder to encode a new bitmap image.

FileStream stream = new FileStream("new.png", FileMode.Create);
PngBitmapEncoder encoder = new PngBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Interlace = PngInterlaceOption.On;
encoder.Frames.Add(BitmapFrame.Create(image));
encoder.Save(stream);

.NET Framework
Available since 3.0
Return to top
Show: