# Annotate on images in C# .NET

Adding annotations to images is possible using XMP annotations with the XML-based syntax. The XMP annotations are handled by the [`AnnotationManager` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html). The list below shows all possible XMP annotation types:

- Text annotation

- Rubber stamp

- Geometric — An annotation represented as a geometric figure (line, arrow, ellipse, polygon, and so on).

- Free hand — A freely drawn line.

- Comment annotation — An annotation linked to an already existing annotation.

- Sticky note — A text annotation confined in a colored rectangular area with borders.

To learn more about XMP annotations, refer to the [XMP annotations](/guides/dotnet/annotations/xmp-annotations.md) guide.

To add an XMP annotation to an image, use the following steps:

1. Create an [`AnnotationManager` object](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html).

2. Load an image to the `AnnotationManager` object with the [`InitFromFile` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html).

3. Use any method from the [`AnnotationManager` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html) that starts with `Add...` to add an XMP annotation. Alternatively, create a new annotation by using the specific annotation class — for example, the [`AnnotationRubberStamp` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~AddRubberStampAnnot.html).

4. Optional: Set the XMP annotation’s properties. For more information, refer to the guide covering [XMP annotation object properties](https://www.nutrient.io/guides/dotnet/annotations/xmp-annotations.md#xmp-annotation-object-properties).

5. Save the newly created annotation with the [`SaveAnnotationsToPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html).

6. Optional: Flatten the XMP annotation into the image with the [`BurnAnnotationsToPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~BurnAnnotationsToPage.html). Flattened annotations are no longer editable.

7. Save the image with the [`SaveDocumentToJPEG` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveDocumentToJPEG.html).

To add a stamp annotation and flatten it into an image, use the following code:

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.jpg");
// Create a new `AnnotationEllipse` object.
AnnotationRubberStamp annotStamp = annotationManager.AddRubberStampAnnot(GdPictureColor.Blue, 2, 1, 4, 2, "APPROVED");
// Rotate the annotation clockwise by 30 degrees.
annotStamp.Rotation = -30;
// Set the `Author` property of the annotation.
annotStamp.Author = "Nutrient";
// Save the annotation to the image.
annotationManager.SaveAnnotationsToPage();
// Flatten the annotation.
annotationManager.BurnAnnotationsToPage(false);
// Save the image with the annotation to a file.
annotationManager.SaveDocumentToJPEG(@"C:\temp\output.jpg", 75);

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.jpg")
    ' Create a new `AnnotationEllipse` object.
    Dim annotStamp As AnnotationRubberStamp = annotationManager.AddRubberStampAnnot(GdPictureColor.Blue, 2, 1, 4, 2, "APPROVED")
    ' Rotate the annotation clockwise by 30 degrees.
    annotStamp.Rotation = -30
    ' Set the `Author` property of the annotation.
    annotStamp.Author = "Nutrient"
    ' Save the annotation to the image.
    annotationManager.SaveAnnotationsToPage()
    ' Flatten the annotation.
    annotationManager.BurnAnnotationsToPage(False)
    ' Save the image with the annotation to a file.
    annotationManager.SaveDocumentToJPEG("C:\temp\output.jpg", 75)
End Using

```

#### Used methods

- [`AddRubberStampAnnot`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~AddRubberStampAnnot.html)

- [`BurnAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~BurnAnnotationsToPage.html)

- [`InitFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

- [`SaveAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html)

- [`SaveDocumentToJPEG`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveDocumentToJPEG.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)
---

## Related pages

- [Attach an image to an annotation in C#](/guides/dotnet/annotations/attach-an-image.md)
- [Attach a file to an annotation in C#](/guides/dotnet/annotations/attach-a-file.md)
- [Custom annotations](/guides/dotnet/annotations/custom-annotations.md)
- [Export annotation data from PDFs in C# .NET](/guides/dotnet/annotations/export-pdf.md)
- [Create an annotation in a PDF using C#](/guides/dotnet/annotations/create.md)
- [Export XMP annotation data in C# .NET](/guides/dotnet/annotations/export-xmp.md)
- [Edit PDF annotations in C#](/guides/dotnet/annotations/edit.md)
- [Flatten PDF annotations in C# .NET](/guides/dotnet/annotations/flatten.md)
- [Import XMP annotation data to PDF or image in C#](/guides/dotnet/annotations/import-xmp.md)
- [Import XFDF annotation data to PDFs in C# .NET](/guides/dotnet/annotations/import-xfdf.md)
- [Get PDF annotation properties in C# .NET](/guides/dotnet/annotations/get-properties.md)
- [PDF annotations in C#.NET](/guides/dotnet/annotations.md)
- [Remove PDF annotations in C# .NET](/guides/dotnet/annotations/remove.md)
- [Add PDF actions using C# in form fields](/guides/dotnet/annotations/pdf-actions-support.md)
- [Stamp a PDF document in C# .NET](/guides/dotnet/annotations/stamp-a-document.md)
- [XMP annotations in C# .NET](/guides/dotnet/annotations/xmp-annotations.md)

