MarkinJS Interactive Examples

Explore features with live demonstrations.

Demo Image

Basic Controls

Advanced Controls
Management
History

Current: 1.0x

Event Log

Code Examples

Basic Annotation

const annotator = MarkinJS.createImageAnnotator('my-image');

// Simple bounding box
annotator.createAnnotation({
    class: "person",
    bbox: [100, 100, 300, 400]
});

Keypoint Detection

// Face with keypoints
annotator.createAnnotation({
    class: "face",
    bbox: [100, 80, 200, 180],
    keypoints: [
        { name: "left_eye", point: [130, 110] },
        { name: "right_eye", point: [170, 110] },
        { name: "nose", point: [150, 130] }
    ]
});

Bound Elements

// Elements that move together
annotator.createAnnotation({
    class: "person",
    bbox: [150, 100, 300, 250],
    keypoints: [{ name: "head", point: [225, 130] }],
    bindElements: true,
    containRules: ["keypoint"]
});

Event Handling

// Listen for interactions
annotator.on('select', (data) => {
    console.log('Selected:', data.type);
});

annotator.on('elementmoved', (data) => {
    console.log('Moved:', data.deltaX, data.deltaY);
});

Keyboard Shortcuts

  • Arrow Keys: Move by 1 pixel
  • Shift + Arrow Keys: Move by 10 pixels
  • Ctrl + Arrow Keys: Move by 0.2 pixels
  • Delete Key: Remove annotation
  • Ctrl + Z: Undo
  • Ctrl + Shift + Z: Redo

Ready to Build Your Own Tool?

Start with our comprehensive API documentation