Extracting image from image annotation

If you added any ImageAnnotation to file and saved it using Annotator, you can extract Image from ImageAnnotation using ImageAnnotation.GetImage() method.

Here is the example of the code:

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}");

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.