---
title: "Auto Contrast"
canonical: https://www.graphicsmill.com/samples/Transforms/BrightnessAndContrast/AutoContrast_cs
product: "Graphics Mill"
source: "Transforms/BrightnessAndContrast/AutoContrast.cs"
---

# Auto Contrast

Adjusts contract automatically.

## Instruction

Apply automatic contrast adjustment to an image.

## Code Snippet

```csharp
using (var bitmap = new Bitmap("Chicago.jpg"))
{
    bitmap.ColorAdjustment.AutoContrast();

    bitmap.Save("AutoContrast.jpg");
}
```

## Explanation

The code:

- Uses the `AutoContrast` method to automatically adjust the contrast of the image.
- Saves the processed image with enhanced contrast.

## Tags

- [Bitmap](<https://www.graphicsmill.com/samples/tags/bitmap_md>): Working with images via the Bitmap API
- [Color Adjustment](<https://www.graphicsmill.com/samples/tags/color-adjustment_md>): Adjusting brightness, contrast and color

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [AutoContrast.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/AutoContrast_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.ColorAdjustment](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_ColorAdjustment.htm.md>)
- [Aurigma.GraphicsMill.ColorAdjustmentProvider.AutoContrast](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorAdjustmentProvider_AutoContrast.htm.md>)
