Extract an image from an image annotation
Leave feedback
On this page
You can extract an image from the ImageAnnotation object. To do this, call the ImageAnnotation.GetImage() method.
The following code snippet shows how to extract an image from an image annotation:
using (Annotator annotator = new Annotator("annotated_file.docx"))
{
List<AnnotationBase> annotations = annotator.Get();
for (int i = 0; i < annotations.Count; i++)
{
if (annotations[i] is ImageAnnotation imageAnnotation)
{
Image image = imageAnnotation.GetImage();
image.Save($"extracted_image{i + 1}.{imageAnnotation.ImageExtension}");
}
}
}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.