---
title: "CustomFormatWriter..::.SaveFrameBitmap Method "
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_CustomFormatWriter_SaveFrameBitmap_1_fd4033ef.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/)

# CustomFormatWriter.SaveFrameBitmap Method 
 
Write the specified bitmap to a file at current position.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Protected Friend MustOverride Sub SaveFrameBitmap ( _bitmap As Bitmap _
)
```
 
```csharp
protected internal abstract void SaveFrameBitmap(Bitmap bitmap
)
```
 
### Parameters
 
 - bitmap
     - Type: [Aurigma.GraphicsMill.Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
 [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) class instance that represents the image to save.
 
## Remarks
  
If you need to get frame settings like quality, position, etc, you need to implement the [SaveFrameParameters(Frame)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_CustomFormatWriter_SaveFrameParameters_1_f2ca33e0.htm.md) method. In this method you will get the frame before the bitmap will be extracted and passed to the SaveFrameBitmap(Bitmap). This way you will be able to save parameters in private variables of your class or whatever else.
 
## Examples
  
```csharp
protected override void SaveFrameBitmap(Bitmap bitmap)
{
    if (bitmap == null)
        throw new ArgumentNullException("bitmap");
        
    //_stream is a stream opened by the writer
    _stream.Seek(0, System.IO.SeekOrigin.Begin);

    //...Handle encoder options, if any
    
    //...Write a header

    //Get an access to the bitmap data
    BitmapData bmData = bitmap.LockBits();
    
    //Write pixel data into a stream
    try
    {
        //Call the base method to initialize progress notification
        base.ResetEvents(bitmap.Height);
        
        for (int i = 0; i < bitmap.Height; i++)
        {
            //...Encode a row of pixels and write it to the stream
            
            //Call the base method to update the progress state
            base.UpdateEvents();
        }
    }
    finally
    {
        bitmap.UnlockBits(bmData);
    }
}
```
   
## See Also

### Reference

- [CustomFormatWriter Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_CustomFormatWriter.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
