---
title: "Bitmap Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.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/)

# Bitmap Class
 
This class represents bitmap, i.e. object which stores raster data.
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
<SerializableAttribute> _
Public Class Bitmap _Inherits UnitConverterObject _Implements ICloneable, ISerializable, IStateNavigable
```
 
```csharp
[SerializableAttribute]
public class Bitmap : UnitConverterObject, ICloneable, ISerializable, IStateNavigable
```
 
## Remarks
  
This is the most essential class of Graphics Mill for .NET. It incapsulates raster image and stores bitmap as well as other related data.
 
To load bitmap, you can either format reader returned from [FormatManager](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_FormatManager.htm.md), or just pass filename into [Load(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Load_1_bb3a7a4f.htm.md) or [constructor](https://www.graphicsmill.com/docs/gm5/C_Aurigma_GraphicsMill_Bitmap_ctor_1_362212bd.htm.md). Also you create new empty bitmap with [Create(Single, Single, PixelFormat)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Create_3_1e94d4e7.htm.md) method.
 
Using appropriate properties you can get such details about loaded image as [Width](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_Width.htm.md), [Height](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_Height.htm.md), [PixelFormat](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_PixelFormat.htm.md), [ColorSpace](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_ColorSpace.htm.md), [BitsPerPixel](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_BitsPerPixel.htm.md), etc.
 
To apply some effect or transform, you should pass this bitmap into [ApplyTransform(Bitmap)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Transforms_BitmapTransform_ApplyTransform_1_fd4033ef.htm.md) method of appropriate [BitmapTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_BitmapTransform.htm.md) class descendant. Alternatively you can use methods exposed in [ColorAdjustment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_ColorAdjustment.htm.md) and [Transforms](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_Transforms.htm.md) properties. It is less flexible, but has shorter syntax. You can undo or redo any operation with [Undo()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Undo.htm.md)/[Redo()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Redo.htm.md) methods.
 
Let's assume you need to work with bitmap channels: split channels into several grayscale bitmaps, replace some channel with grayscale image, swap channels, add/remove alpha channel, etc. In this case you should use methods exposed by [Channels](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Bitmap_Channels.htm.md) property.
 
If standard imaging features of Graphics Mill for .NET are not enough to you, you can use [LockBits()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_LockBits.htm.md) method which returns a [BitmapData](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_BitmapData.htm.md) object. This object gives you direct access to the bitmap pixels. If you need just get/set the single pixel value, you can use easy-to-use pair of methods [GetPixel(Int32, Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_GetPixel_2_22dcb54d.htm.md)/[SetPixel(Int32, Int32, Color)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_SetPixel_3_5b67216d.htm.md).
 
To save result to file you also can either use format writers or the [Save(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Save_1_bb3a7a4f.htm.md) method.
 
This class also provides a number of useful events. Event [Progress](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Progress.htm.md) allows you creating progress bar. Using events [Undone](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Undone.htm.md) and [Redone](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Redone.htm.md) you can enable or disable appropriate menu items. Event [Changed](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Changed.htm.md) fires when some operation has changed the bitmap. In event [Changing](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Changing.htm.md) you can cancel the operation which is going to modify the bitmap. The similar pair of events is available for bitmap saving: [Saving](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Saving.htm.md) fires before the bitmap is saved, [Saved](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Saved.htm.md) - after. [Saving](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Saving.htm.md) event is convenient to set encoder parameters at: it passes [EncoderOptions](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_EncoderOptions.htm.md) object which you can initialize and these settings will be applied during encoding. Therefore it is convenient place to put a save parameters dialogs at.
 
## Examples
  
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\mountain.jpg")
```
 
```csharp
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\mountain.jpg");
```
 
## 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.UnitConverterObject](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_UnitConverterObject.htm.md)
            - Aurigma.GraphicsMill.Bitmap
 
## 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_40.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_43.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorAdjustmentProvider.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_44.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorManagementProvider.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_14.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorProfile.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_46.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_47.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_41.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_49.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_50.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_BitmapData.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_51.png)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_52.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorPalette.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_53.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ChannelsProvider.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_54.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_BitmapStatisticsProvider.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_55.png)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_56.png)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_57.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_TransformsProvider.htm.md)
  
## See Also

### Reference

- [Bitmap Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Bitmap.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
