This class represents a frame of the PNG format.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Public NotInheritable Class PngFrame _ Inherits Frame
public sealed class PngFrame : Frame
Also you can use PngWriter class instead of the Save(String, IEncoderOptions) method of the Bitmap. In particular it enables you to save the image asynchronously.
The PngWriter class usage is demonstrated below:
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg") Dim writer As New Aurigma.GraphicsMill.Codecs.PngWriter("C:\Mountain.png") Dim frame As New Aurigma.GraphicsMill.Codecs.PngFrame frame.Interlaced = True frame.SetBitmap(bitmap) bitmap.Dispose() writer.AddFrame(frame) frame.Dispose() writer.Dispose()
using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg")) { using (Aurigma.GraphicsMill.Codecs.PngWriter writer = new Aurigma.GraphicsMill.Codecs.PngWriter(@"C:\Mountain.png")) { using (Aurigma.GraphicsMill.Codecs.PngFrame frame = new Aurigma.GraphicsMill.Codecs.PngFrame()) { frame.Interlaced = true; frame.SetBitmap(bitmap); writer.AddFrame(frame); } } }
This code sample converts the image into the indexed bitmap with 32 palette entries. After that it saves this bitmap into the PNG file.
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg") bitmap.ColorManagement.PaletteEntryCount = 32 bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, _ Nothing) Dim writer As New Aurigma.GraphicsMill.Codecs.PngWriter("C:\Mountain.png") Dim frame As New Aurigma.GraphicsMill.Codecs.PngFrame frame.Interlaced = True frame.SetBitmap(bitmap) bitmap.Dispose() writer.AddFrame(frame) frame.Dispose() writer.Dispose()
using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg")) { bitmap.ColorManagement.PaletteEntryCount = 32; bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, null); using (Aurigma.GraphicsMill.Codecs.PngWriter writer = new Aurigma.GraphicsMill.Codecs.PngWriter(@"C:\Mountain.png")) { using (Aurigma.GraphicsMill.Codecs.PngFrame frame = new Aurigma.GraphicsMill.Codecs.PngFrame()) { frame.Interlaced = true; frame.SetBitmap(bitmap); writer.AddFrame(frame); } } }