---
title: "PngFrame Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_PngFrame.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# PngFrame Class
 
This class represents a frame of the PNG format.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class PngFrame _Inherits Frame
```
 
```csharp
public sealed class PngFrame : Frame
```
 
## Examples
  
Also you can use [PngWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_PngWriter.htm.md) class instead of the [Save(String, IEncoderOptions)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Save_2_b73a8298.htm.md) method of the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md). In particular it enables you to save the image asynchronously.
 
The [PngWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_PngWriter.htm.md) 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()
```
 
```csharp
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()
```
 
```csharp
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
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.LockableObject](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_LockableObject.htm.md)
        - [Aurigma.GraphicsMill.Codecs.Frame](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_Frame.htm.md)
            - Aurigma.GraphicsMill.Codecs.PngFrame
 
## 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

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_198.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_PngFrame.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_14.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
  
## See Also

### Reference

- [PngFrame Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Codecs_PngFrame.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
