---
title: "ApplyLut Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_ApplyLut.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/)

# ApplyLut Class
 
This class enables you to apply tone correction using specified look-up table (LUT).
 
**Namespace:** [Aurigma.GraphicsMill.Transforms](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Transforms.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class ApplyLut _Inherits PerChannelBitmapTransform
```
 
```csharp
public sealed class ApplyLut : PerChannelBitmapTransform
```
 
## Remarks
  
Look-up table (LUT) is an array specifying mapping function for pixels. The algorithm works in the following way: it iterates through each pixels on each channels separately. It takes a channel luminosity and uses it as index in LUT array to get a value to copy to corresponding channel and pixel of the result image. Pseudocode for this algorithm is looking in the following way:
 
```
' This is a pseudocode demonstrating 
' how LUT works. Note, it is not an actual code and 
' this syntax is not correct for Graphics Mill objects! It
' is just used for brevity.

' Let's assume that width and height - image dimension (both for input 
' and output), channelCount - number of channels defined for bitmap pixel format
' (also the same in both bitmaps). LUT is specified look-up table

For i = 0 To height - 1For j = 0 To width - 1	For k = 0 to channelCount - 1		outputBitmap(i, j, k) = LUT(inputBitmap(i, j, k))	NextNext
Next
```
 
```csharp
// This is a pseudocode demonstrating 
// how LUT works. Note, it is not an actual code and 
// this syntax is not correct for Graphics Mill objects! It
// is just used for brevity.

// Let's assume that width and height - image dimension (both for input 
// and output), channelCount - number of channels defined for bitmap pixel format
// (also the same in both bitmaps). LUT is specified look-up table

for ( i = 0; i &lt; height - 1; i++)
{for ( j = 0; j &lt; width - 1; j++){	for ( k = 0; k &lt; channelCount - 1; k++)	{		outputBitmap[i, j, k] = LUT[inputBitmap[i, j, k]];	}}
}
```
 
To specify look-up table you should use property [Lut](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_ApplyLut_Lut.htm.md). Look-up tables are represented with [Aurigma.GraphicsMill.Transforms.Lut](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_Lut.htm.md) class which provides a number of methods allowing to generate LUT as standard function.
 
As usual LUT should not affect the alpha channel. When property [ApplyOnAlpha](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PerChannelBitmapTransform_ApplyOnAlpha.htm.md) is set to **false**, alpha channel is not modified with algorithm even if it is enabled with [Channels](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Transforms_PerChannelBitmapTransform_Channels.htm.md) property.
 
## Examples
  
```
Dim applyLut As New Aurigma.GraphicsMill.Transforms.ApplyLut

'LUT for image posterizing
applyLut.Lut.BuildStaircase(10, False)

applyLut.ApplyTransform(bitmap)
```
 
```csharp
Aurigma.GraphicsMill.Transforms.ApplyLut applyLut = 
    new Aurigma.GraphicsMill.Transforms.ApplyLut();

//LUT for image posterizing
applyLut.Lut.BuildStaircase(10, false);

applyLut.ApplyTransform(bitmap);
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.SyncHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_SyncHandler.htm.md)
        - [Aurigma.GraphicsMill.UnitConverterHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_UnitConverterHandler.htm.md)
            - [Aurigma.GraphicsMill.Transforms.BitmapTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_BitmapTransform.htm.md)
                - [Aurigma.GraphicsMill.Transforms.MaskedBitmapTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_MaskedBitmapTransform.htm.md)
                    - [Aurigma.GraphicsMill.Transforms.PerChannelBitmapTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_PerChannelBitmapTransform.htm.md)
                        - Aurigma.GraphicsMill.Transforms.ApplyLut
 
## 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_282.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_ApplyLut.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_283.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_Lut.htm.md)
 
## Supported Pixel Formats

| Member Name | Description |
| --- | --- |
| **Format8bppGrayScale** | 8 bits per pixel. Grayscale. 8 bits are used for luminosity level. |
| **Format16bppGrayScale** | 16 bits per pixel. Grayscale. All 16 bits are used for luminosity level (extended pixel format). |
| **Format16bppAGrayScale** | 16 bits per pixel. Grayscale with alpha channel. 8 bits are used for alpha channel and other 8 bits are used for luminosity level. |
| **Format32bppAGrayScale** | 32 bits per pixel. Grayscale with alpha channel. 16 bits are used for alpha channel and other 16 bits are used for luminosity level (extended pixel format). |
| **Format24bppRgb** | 24 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. |
| **Format32bppRgb** | 32 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. The rest 8 bits are unused. |
| **Format32bppArgb** | 32 bits per pixel. RGB with alpha channel. 8 bits each are used for the alpha, red, green, and blue components. |
| **Format48bppRgb** | 48 bits per pixel. RGB. 16 bits each are used for the red, green, and blue components (extended pixel format). |
| **Format64bppArgb** | 64 bits per pixel. RGB with alpha channel. 16 bits each are used for the alpha, red, green, and blue components (extended pixel format). |
| **Format32bppCmyk** | 32 bits per pixel. CMYK. 8 bits each are used for the cyan, magenta, yellow, and black components. |
| **Format64bppCmyk** | 64 bits per pixel. CMYK. 16 bits each are used for the cyan, magenta, yellow, and black components (extended pixel format). |
| **Format80bppAcmyk** | 80 bits per pixel. CMYK with alpha channel. 16 bits each are used for the alpha, cyan, magenta, yellow, and black components (extended pixel format). |
 
## See Also

### Reference

- [ApplyLut Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Transforms_ApplyLut.htm.md)
- [Aurigma.GraphicsMill.Transforms Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Transforms.htm.md)
