---
title: "Levels"
canonical: https://www.graphicsmill.com/samples/Transforms/AdvancedToneCorrection/Levels_cs
product: "Graphics Mill"
source: "Transforms/AdvancedToneCorrection/Levels.cs"
---

# Levels

Apply custom levels adjustment to an image.

## Instruction

Apply custom levels adjustment to an image.

## Code Snippet

```csharp
using (var bitmap = new Bitmap("Chicago.jpg"))
{
    bitmap.ColorAdjustment.Levels(0.03F, 0.9F, 0.05F, 1.5F, 0.7F, HistogramMode.Sum);

    bitmap.Save("Levels.jpg");
}
```

## Explanation

The code:

- Adjusts the levels of the image using custom input/output levels and midpoint values.
- Applies the histogram adjustment using the `HistogramMode.Sum` mode for enhancing the image brightness and contrast.
- Saves the adjusted image in the output file.

## 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

- [Levels.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/Levels_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.ColorAdjustment](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_ColorAdjustment.htm.md>)
- [Aurigma.GraphicsMill.ColorAdjustmentProvider.Levels(Single,Single,Single,Single,Single,HistogramMode)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorAdjustmentProvider_Levels_6_2fbf0260.htm.md>)
- [Aurigma.GraphicsMill.HistogramMode](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_HistogramMode.htm.md>)
