---
title: "Transparentize"
canonical: https://www.graphicsmill.com/samples/ColorManagement/Channels/Transparentize_cs
product: "Graphics Mill"
source: "ColorManagement/Channels/Transparentize.cs"
---

# Transparentize

Sets alpha values of pixels with a given color to transparent.

## Instruction

Demonstrates how to add transparency to an image by transparentizing a specific color using `Bitmap.Channels`

## Code Snippet

```csharp
using (var bitmap = new Bitmap("ImageOnWhite.png"))
{
    bitmap.Channels.SetAlpha(1f);
    bitmap.Channels.Transparentize(new RgbColor(255, 255, 244), 0.1f);

    bitmap.Save("Transparentize.png");
}
```

## Explanation

The following code:

- Loads the image (`ImageOnWhite.png`) into a `Bitmap` object.
- Sets an alpha channel with full opacity using `bitmap.Channels.SetAlpha(1f)`.
- Transparentizes a specific color (RgbColor(0x8a, 0xb9, 0xed)) with 10% transparency using `bitmap.Channels.Transparentize()`.
- Saves the resulting image as `Transparentize.png`.

## 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
- [Transparentize](<https://www.graphicsmill.com/samples/tags/transparentize_md>): Making pixels transparent with transforms

## Input

- [ImageOnWhite.png](<https://www.graphicsmill.com/samples/ColorManagement/compiled/Debug/ImageOnWhite_png>) (preview)

## Output

- [Transparentize.png](<https://www.graphicsmill.com/samples/ColorManagement/compiled/Debug/Transparentize_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.Channels](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Channels.htm.md>)
- [Aurigma.GraphicsMill.ChannelsProvider.SetAlpha(Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ChannelsProvider_SetAlpha_1_7a94462e.htm.md>)
- [Aurigma.GraphicsMill.ChannelsProvider.Transparentize(Color,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ChannelsProvider_Transparentize_2_d079cd70.htm.md>)
