This project provides an annotation tool for HTML video and image elements. The tool allows users to draw and annotate over video and images using various drawing tools, including curves, rectangles, ellipses, and texts. Users can also customize the color and stroke size of their annotations.
Demo: lifeart.github.io/sm-annotate
Add the package to your project using yarn:
yarn add https://github.com/lifeart/sm-annotate.gitimport { SmAnnotate } from '@lifeart/sm-annotate';
const video = document.getElementById('video');
const annotationTool = new AnnotationTool(video);Users can draw and annotate using the available tools (curve, rectangle, ellipse, and text) and customize the color and stroke size of the annotations. The tool also supports undo functionality and event handling for pointer events (mouse and touch).
To save the current frame or all frames with annotations, use the saveCurrentFrame or saveAllFrames methods, respectively.
| KeyCode | Result |
|---|---|
Shift |
Magnifier x2 |
r |
Red color |
g |
Green color |
b |
Blue color |
y |
Yellow color |
1 - 9
|
Tool size |
We welcome contributions to improve the project. Please feel free to submit issues or pull requests for consideration.
This code is allowed for non-commercial use. For commercial use, users must contact the author.