---
title: "RGB To Lab With Color Management"
canonical: https://www.graphicsmill.com/samples/ColorManagement/ConvertingColorValues/RgbToLabWithColorManagement_cs
product: "Graphics Mill"
source: "ColorManagement/ConvertingColorValues/RgbToLabWithColorManagement.cs"
---

# RGB To Lab With Color Management

Converts a color specified in RGB color space to LAB color space.

## Instruction

Write a C# program that converts an RGB color (R=223, G=210, B=30) with sRGB profile to LAB color space using color management via the To<LabColor> method without explicit destination profile, then displays the conversion result using Console.WriteLine.

## Usings

```csharp
using System;
```

## Code Snippet

```csharp
RgbColor rgbColor = new RgbColor(223, 210, 30)
{
    Profile = ColorProfile.FromSrgb(),
};

LabColor labColor = rgbColor.To<LabColor>();

Console.WriteLine("With color management: {0} to {1}", rgbColor, labColor);
```

## Explanation

Below is a C# code sample that performs RGB to LAB color space conversion with color management:

The code demonstrates RGB to LAB conversion using GraphicsMill's color management system. It creates an RgbColor with specific values and assigns sRGB source profile, then uses the generic To<LabColor>() method which performs device-independent color space transformation to CIELAB color space using the source profile's color space as reference. LAB conversion is useful for color comparison, sorting, and perceptual uniformity calculations in image processing workflows.

## Tags

- [Color Conversion](<https://www.graphicsmill.com/samples/tags/color-conversion_md>): Converting colors between color spaces
- [Color Management](<https://www.graphicsmill.com/samples/tags/color-management_md>): Color management with ICC profiles

## Output

- [RgbToLabWithColorManagement.txt](<https://www.graphicsmill.com/samples/ColorManagement/compiled/Debug/RgbToLabWithColorManagement_txt>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Color.Profile](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Color_Profile.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.LabColor](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_LabColor.htm.md>)
