It’s possible to create image annotations using the UI using the corresponding toolbar button:
Pressing the button will open a file select dialog which will allow you to choose a PNG, JPEG or PDF file to use as attachment for the annotation.
Once the image is picked, the image annotation will be created in the current page with the selected image. When selected, you can use the UI to move it, resize it, or change its opacity:
The attachment is included along with the image annotation when changes are persisted to the document.
Images included using the UI can also be programmatically extracted if needed by passing the attachment ID to
instance#getAttachment, which will resolve to a
Blob containing the image file.
const attachmentBlob = await instance.getAttachment(imageAnnotation.imageAttachmentId);