This documentation is for the old version. Go to the latest Graphics Mill docs

PngFrame Class

This class represents a frame of the PNG format.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public NotInheritable Class PngFrame _
	Inherits Frame
C#
public sealed class PngFrame : Frame

Examples

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:

Visual Basic
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()
C#
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.

Visual Basic
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()
C#
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);
        }
    }
}

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model




See Also

Reference