---
title: "Create Vignette"
canonical: https://www.graphicsmill.com/samples/LargeImages/Transforms/CreateVignette_cs
product: "Graphics Mill"
source: "LargeImages/Transforms/CreateVignette.cs"
---

# Create Vignette

Creates a vignette with a specified color.

## Instruction

Write a C# program that creates a vignette effect on "Venice.jpg" by generating an elliptical grayscale mask with blurred edges using GraphicsContainer and Blur transform, then applies it to the original image via dual Pipeline processing with ScaleAlpha and RemoveAlpha transforms to produce "VeniceVignette.jpg" with white vignette borders.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Drawing;
using Aurigma.GraphicsMill.Transforms;
```

## Code Snippet

```csharp
const float borderScale = 0.05f;
const float blurRadiusScale = borderScale / 2.0f;

using (var reader = ImageReader.Create("Venice.jpg"))
using (var gc = new GraphicsContainer(reader.Width, reader.Height, reader.DpiX, reader.DpiY))
using (var gr = gc.GetGraphics())
{
    int offset = (int)(reader.Width * borderScale);

    gr.FillEllipse(new SolidBrush(RgbColor.White), offset, offset, gc.Width - (2 * offset), gc.Height - (2 * offset));

    // One pipeline for generating an alpha channel
    var alphaPipeline = new Pipeline();
    alphaPipeline.Add(new ImageGenerator(gc, PixelFormat.Format8bppGrayscale, RgbColor.Black));
    alphaPipeline.Add(new Blur(reader.Width * blurRadiusScale));

    // And another one for getting a final content
    var pipeline = new Pipeline();
    pipeline.Add(reader);
    pipeline.Add(new ScaleAlpha(alphaPipeline));
    pipeline.Add(new RemoveAlpha(RgbColor.White));
    pipeline.Add(ImageWriter.Create("VeniceVignette.jpg"));

    try
    {
        pipeline.Run();
    }
    finally
    {
        pipeline.DisposeAllElements();
        alphaPipeline.DisposeAllElements();
}
```

## Explanation

Below is a C# code sample that creates a professional vignette effect using advanced Pipeline techniques:

The code demonstrates sophisticated vignette creation using dual Pipeline approach: first pipeline generates blurred elliptical alpha mask via GraphicsContainer.FillEllipse with SolidBrush, ImageGenerator to 8bpp grayscale, and Blur transform; second pipeline composites original image with ScaleAlpha mask application followed by RemoveAlpha with white background. The technique uses borderScale (5%) for vignette sizing and blurRadiusScale for smooth edge feathering, with proper resource cleanup via DisposeAllElements in try-finally block, suitable for large images without full bitmap loading.

## Tags

- [Channels](<https://www.graphicsmill.com/samples/tags/channels_md>): Reading and combining image channels
- [Drawing](<https://www.graphicsmill.com/samples/tags/drawing_md>): Drawing vector shapes and text
- [Pipeline](<https://www.graphicsmill.com/samples/tags/pipeline_md>): Working with images via the Pipeline API
- [Vignette](<https://www.graphicsmill.com/samples/tags/vignette_md>): Applying a vignette effect

## Input

- [Venice.jpg](<https://www.graphicsmill.com/samples/LargeImages/compiled/Debug/Venice_jpg>) (preview)

## Output

- [VeniceVignette.jpg](<https://www.graphicsmill.com/samples/LargeImages/compiled/Debug/VeniceVignette_jpg>) (preview)

## Used APIs

- [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.ImageReader.DpiX](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_DpiX.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.DpiY](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_ImageReader_DpiY.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.Drawing.Graphics.FillEllipse(Brush,Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillEllipse_5_2d30ad96.htm.md>)
- [Aurigma.GraphicsMill.Drawing.GraphicsContainer](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_GraphicsContainer.htm.md>)
- [Aurigma.GraphicsMill.Drawing.GraphicsContainer.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_GraphicsContainer_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.ImageGenerator](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_ImageGenerator.htm.md>)
- [Aurigma.GraphicsMill.Transforms.Blur](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_Blur.htm.md>)
- [Aurigma.GraphicsMill.Transforms.RemoveAlpha](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_RemoveAlpha.htm.md>)
- [Aurigma.GraphicsMill.Transforms.ScaleAlpha](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_ScaleAlpha.htm.md>)
