---
title: "Bitmap.GetGraphics Method "
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.htm
product: "Graphics Mill"
---

# Bitmap.GetGraphics Method 
 
Gets the [Graphics](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md) object associated with this [Bitmap](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md).
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public Graphics GetGraphics()
```
 
### Return Value
A [Graphics](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md) object associated with this [Bitmap](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md).
 
## Remarks
  
Several calls of this method will return the same object.
 
You can freely dispose the [Graphics](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Graphics.htm.md) returned with this method, although it is not necessary. If you dispose this graphics object, next call of the GetGraphics() method will create new instance of this class.
 
## Examples
  
```csharp
using (var bitmap = new Bitmap(100, 60, PixelFormat.Format24bppRgb, RgbColor.White))
{
    using (Graphics graphics = bitmap.GetGraphics())
    {
        var bluePen = new Pen(RgbColor.Blue, 8);
        graphics.DrawLine(bluePen, 10, 55, 90, 5);

        var redPen = new Pen(RgbColor.Red, 8);
        graphics.DrawLine(redPen, 10, 5, 90, 55);

        bitmap.Save(@"Images\Output\pen.png");
    }
}
```
   
## See Also

### Reference

- [Bitmap Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
