---
title: "Tint Using Alpha"
canonical: https://www.graphicsmill.com/samples/Transforms/Tint/TintUsingAlpha_cs
product: "Graphics Mill"
source: "Transforms/Tint/TintUsingAlpha.cs"
---

# Tint Using Alpha

Tints using alpha channel.

## Instruction

Apply tint using alpha channel and invert colors.

## Code Snippet

```csharp
using (var bitmap = new Bitmap("Chicago.jpg"))
{
    using (var result = new Aurigma.GraphicsMill.Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb, RgbColor.Green))
    {
        bitmap.ColorManagement.Convert(PixelFormat.Format8bppGrayscale);
        bitmap.Transforms.Invert();

        result.Channels.SetAlpha(bitmap);
        result.Channels.RemoveAlpha(RgbColor.White);

        result.Save("TintUsingAlpha.jpg");
    }
}
```

## Explanation

The code:

- Loads the image from the file "Chicago.jpg".
- Converts the image to 8bpp grayscale format and inverts the colors.
- Creates a new result image with a green background, then sets the alpha channel from the original bitmap.
- Removes the white color from the alpha channel to use as transparency.
- Saves the final result to a new file, "TintUsingAlpha.jpg".

## Tags

- [Bitmap](<https://www.graphicsmill.com/samples/tags/bitmap_md>): Working with images via the Bitmap API
- [Channels](<https://www.graphicsmill.com/samples/tags/channels_md>): Reading and combining image channels
- [Color Conversion](<https://www.graphicsmill.com/samples/tags/color-conversion_md>): Converting colors between color spaces
- [Transform](<https://www.graphicsmill.com/samples/tags/transform_md>): Image transforms and effects

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [TintUsingAlpha.jpg](<https://www.graphicsmill.com/samples/Transforms/compiled/Debug/TintUsingAlpha_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.Channels](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Channels.htm.md>)
- [Aurigma.GraphicsMill.Bitmap.ColorManagement](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_ColorManagement.htm.md>)
- [Aurigma.GraphicsMill.Bitmap.Transforms](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Transforms.htm.md>)
- [Aurigma.GraphicsMill.ChannelsProvider.RemoveAlpha(Color)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ChannelsProvider_RemoveAlpha_1_929597d9.htm.md>)
- [Aurigma.GraphicsMill.ChannelsProvider.SetAlpha(Bitmap)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ChannelsProvider_SetAlpha_1_fd4033ef.htm.md>)
- [Aurigma.GraphicsMill.ColorManagementProvider.Convert(PixelFormat)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorManagementProvider_Convert_1_3e209c07.htm.md>)
- [Aurigma.GraphicsMill.TransformsProvider.Invert](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_TransformsProvider_Invert.htm.md>)
