---
title: "Draw Spot On CMYK"
canonical: https://www.graphicsmill.com/samples/Codecs/SpotColors/DrawSpotOnCmyk_cs
product: "Graphics Mill"
source: "Codecs/SpotColors/DrawSpotOnCmyk.cs"
---

# Draw Spot On CMYK

Draws a text and an image on the spot channel, using the existing CMYK image as a background.

## Instruction

Write a C# program that draws text and an image on the spot channel using a CMYK background in a PDF.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var bgImageReader = ImageReader.Create("Copenhagen_CMYK.jpg"))
using (var pdfWriter = new PdfWriter("SpotWithProcessColors.pdf"))
{
    Pipeline.Run(bgImageReader + pdfWriter);

    using (var gr = pdfWriter.GetGraphics())
    using (var spotImage = new Bitmap("Sheep.gif"))
    {
        var ink = new Ink("PANTONE Red 032 C", new RgbColor(243, 40, 55));
        var spotColor = new SpotColor(ink, 255);
        var text = new PlainText("Spot color text", gr.CreateFont("Arial", 150))
        {
            Position = new System.Drawing.PointF(gr.Width / 2, gr.Height / 2),
            Alignment = TextAlignment.Center,
            Brush = new SolidBrush(spotColor),
        };

        gr.DrawText(text);

        // After these operations, the loaded image reflects a spot color
        spotImage.ColorManagement.Ink = ink;
        spotImage.ColorManagement.Convert(PixelFormat.Format16bppAspot);

        spotImage.Transforms.Resize(400, 400, Aurigma.GraphicsMill.Transforms.ResizeInterpolationMode.Linear, Aurigma.GraphicsMill.Transforms.ResizeMode.Fit);

        gr.DrawImage(spotImage, gr.Width - spotImage.Width, gr.Height - (spotImage.Height / 3));
    }

    pdfWriter.Close();
}
```

## Explanation

Below is a C# code sample that demonstrates how to draw text and an image on the spot channel in a PDF document,
using an existing CMYK image as the background. It uses `PdfWriter` and `ImageReader` to work with the background and spot colors:

This code creates a PDF where text and an image are drawn with a PANTONE spot color on top of a CMYK background image.

## Tags

- [Drawing](<https://www.graphicsmill.com/samples/tags/drawing_md>): Drawing vector shapes and text
- [PDF](<https://www.graphicsmill.com/samples/tags/pdf_md>): Importing and exporting PDF documents
- [Spot Color](<https://www.graphicsmill.com/samples/tags/spot_md>): Using spot colors in images
- [Text](<https://www.graphicsmill.com/samples/tags/text_md>): Rendering and formatting text

## Input

- [Copenhagen\_CMYK.jpg](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/Copenhagen_CMYK_jpg>) (preview)
- [Sheep.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/Sheep_gif>) (preview)

## Output

- [SpotWithProcessColors.pdf](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/SpotWithProcessColors_pdf>) (download)
- [SpotWithProcessColors.png](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/SpotWithProcessColors_png>) (preview)

## Used APIs

- [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.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.ImageWriter.Close](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageWriter_Close.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_PdfWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfWriter.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_PdfWriter_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.ColorManagementProvider.Convert(PixelFormat)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorManagementProvider_Convert_1_3e209c07.htm.md>)
- [Aurigma.GraphicsMill.ColorManagementProvider.Ink](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_ColorManagementProvider_Ink.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.CreateFont(String,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_CreateFont_2_1dbfa9fa.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawImage(Bitmap,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawImage_3_b9413d4f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawText_1_f576d03f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_PlainText.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText.Alignment](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PlainText_Alignment.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText.Position](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PlainText_Position.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Brush](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Brush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.TextAlignment](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_TextAlignment.htm.md>)
- [Aurigma.GraphicsMill.Ink](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Ink.htm.md>)
- [Aurigma.GraphicsMill.SpotColor](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_SpotColor.htm.md>)
- [Aurigma.GraphicsMill.Transforms.ResizeInterpolationMode](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_ResizeInterpolationMode.htm.md>)
- [Aurigma.GraphicsMill.Transforms.ResizeMode](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_ResizeMode.htm.md>)
- [Aurigma.GraphicsMill.TransformsProvider.Resize(Int32,Int32,ResizeInterpolationMode,ResizeMode)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_TransformsProvider_Resize_4_9f3f3567.htm.md>)
