How to add comments (annotations) to a picture with Aspose.Words for Java?

How to annotate (annotate) the second picture, can you give me a sample code?
word has been uploaded ↓
不得擅自引进、释放或丢弃!.docx (307.5 KB)

Expected outcome:
9cd30e4df1d9c6a6eedee0853419ce9.jpg (308.8 KB)

@zou_yw Please consider the following code.

Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 1, true);
Paragraph para = (Paragraph)shape.getParentNode();
Comment cmt = new Comment(doc, "Admin", "", new Date());
cmt.setText("This image is pretty");
para.appendChild(cmt);
para.insertBefore(new CommentRangeStart(doc, cmt.getId()), para.getFirstChild());
para.insertBefore(new CommentRangeEnd(doc, cmt.getId()), para.getLastChild());

thank you for your reply!
Can I trouble you with another demo of annotating text? Also, can you add code comments, thank you very much!

@zou_yw

Yes, of course, please feel free to ask in case of any issues.

// Gets the shape node.
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 1, true);
// Gets the shape parent node.
Paragraph para = (Paragraph)shape.getParentNode();
// Creates a comment with the specified author and date.
Comment cmt = new Comment(doc, "Admin", "", new Date());
// Sets the comment text
cmt.setText("This image is pretty");
// Appends the comment to the end of the parent paragraph.
para.appendChild(cmt);
// Creates the anchor for a comment that spans a paragraph with a shape.
para.insertBefore(new CommentRangeStart(doc, cmt.getId()), para.getFirstChild());
para.insertBefore(new CommentRangeEnd(doc, cmt.getId()), para.getLastChild());

You are attentive!
How about adding comments to text in word?

不得擅自引进、释放或丢弃!(1).docx (309.5 KB)

@zou_yw I removed the comment from your attached file and used it as a template.

// Attached to post.
Document doc = new Document("Input.docx");
// Target parapraph for Comment anchor.
Paragraph para = (Paragraph)doc.getChild(NodeType.PARAGRAPH, 9, true);
// Target Run for Comment anchor.
Run cmtAnchorRun = para.getRuns().get(10);
Comment cmt = new Comment(doc, "weitang", "", new Date());
cmt.setText("This word is error");
para.appendChild(cmt);
para.insertBefore(new CommentRangeStart(doc, cmt.getId()), cmtAnchorRun);
para.insertAfter(new CommentRangeEnd(doc, cmt.getId()), cmtAnchorRun);
doc.Save("output.docx");

Input.docx (307.5 KB)