This guide explains how to make an existing image on your webpage annotatable using
Annotorious with vanilla JavaScript.
Quick Start
Here’s a basic example to get you started. The code below initializes Annotorious
on an existing image, attaches an event listener, and loads annotations from a file.
Step-by-Step Guide
In your JavaScript file, import createImageAnnotator.
Important: import the Annotorious CSS stylesheet.
Create an annotator instance on your image. You can pass
either the ID of the image element, or the DOM element itself.
Optional: you can pass options to customize the annotator.
Load existing annotations. Read more about the data model on the next page.
Script Import
If you are not using a build system, you can include Annotorious via CDN.
The createImageAnnotator function is available under the global Annotorious object.
Working with Annotations
Annotorious provides methods to work with Annotations programmatically:
By default, Annotorious uses its own native data model, which is optimized
for performance and ease of use. However, Annotorious also supports
the W3C Web Annotation Data Model.
The next section introduces the Annotorious annotation data model in more detail,
and explains how to use the W3C Web Annotation format through the W3CImageAdapter.