---
title: "Adjust Colors Using Lab"
canonical: https://www.graphicsmill.com/samples/Transforms/ColorAdjustment/AdjustColorsUsingLab_cs
product: "Graphics Mill"
source: "Transforms/ColorAdjustment/AdjustColorsUsingLab.cs"
---

# Adjust Colors Using Lab

Adjusts hue modifying [a] component of Lab color space.

## Instruction

Adjust colors of an image using Lab channels. The `b` channel (blue/yellow) is modified to increase yellow.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
// L - lightness
// a - green/red
// b - blue/yellow

using (var lChannel = new Bitmap())
using (var aChannel = new Bitmap())
using (var bChannel = new Bitmap())
{
    using (var reader = ImageReader.Create("Chicago.jpg"))
    using (var labConverter = new Aurigma.GraphicsMill.Transforms.ColorConverter(PixelFormat.Format24bppLab))
    using (var splitter = new LabChannelSplitter())
    {
        splitter.L = lChannel;
        splitter.A = aChannel;
        splitter.B = bChannel;

        Pipeline.Run(reader + labConverter + splitter);
    }

    // Increase yellow
    bChannel.ColorAdjustment.ChannelBalance(new float[] { 0.1f }, new float[] { 1f });

    using (var combiner = new LabChannelCombiner())
    using (var rgbConverter = new Aurigma.GraphicsMill.Transforms.ColorConverter(PixelFormat.Format24bppRgb))
    using (var writer = ImageWriter.Create("AdjustColorsUsingLab.jpg"))
    {
        combiner.L = lChannel;
        combiner.A = aChannel;
        combiner.B = bChannel;

        rgbConverter.DestinationProfile = ColorProfile.FromSrgb();

        Pipeline.Run(combiner + rgbConverter + writer);
    }
}
```

## Explanation

The code:

- Splits the image into Lab channels (`L`, `A`, `B`) using a `LabChannelSplitter`.
- The yellow in the `b` channel is increased by applying a channel balance adjustment.
- Combines the channels back together using a `LabChannelCombiner` and converts the result back to RGB format.
- Saves the adjusted image.

## Tags

- [Color Adjustment](<https://www.graphicsmill.com/samples/tags/color-adjustment_md>): Adjusting brightness, contrast and color
- [Pipeline](<https://www.graphicsmill.com/samples/tags/pipeline_md>): Working with images via the Pipeline API

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [AdjustColorsUsingLab.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/AdjustColorsUsingLab_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.ColorAdjustment](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_ColorAdjustment.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ImageReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.Create(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageReader_Create_1_bb3a7a4f.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ImageWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageWriter.Create(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageWriter_Create_1_bb3a7a4f.htm.md>)
- [Aurigma.GraphicsMill.ColorAdjustmentProvider.ChannelBalance(Single\[\],Single\[\])](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorAdjustmentProvider_ChannelBalance_2_9438b101.htm.md>)
- [Aurigma.GraphicsMill.ColorProfile](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_ColorProfile.htm.md>)
- [Aurigma.GraphicsMill.ColorProfile.FromSrgb](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorProfile_FromSrgb.htm.md>)
- [Aurigma.GraphicsMill.LabChannelCombiner](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_LabChannelCombiner.htm.md>)
- [Aurigma.GraphicsMill.LabChannelCombiner.A](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelCombiner_A.htm.md>)
- [Aurigma.GraphicsMill.LabChannelCombiner.B](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelCombiner_B.htm.md>)
- [Aurigma.GraphicsMill.LabChannelCombiner.L](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelCombiner_L.htm.md>)
- [Aurigma.GraphicsMill.LabChannelSplitter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_LabChannelSplitter.htm.md>)
- [Aurigma.GraphicsMill.LabChannelSplitter.A](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelSplitter_A.htm.md>)
- [Aurigma.GraphicsMill.LabChannelSplitter.B](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelSplitter_B.htm.md>)
- [Aurigma.GraphicsMill.LabChannelSplitter.L](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_LabChannelSplitter_L.htm.md>)
- [Aurigma.GraphicsMill.Transforms.ColorConverter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_ColorConverter.htm.md>)
- [Aurigma.GraphicsMill.Transforms.ColorConverter.DestinationProfile](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Transforms_ColorConverter_DestinationProfile.htm.md>)
