尚未检测到更新。GitHub 发布版本后会显示在这里。
Web-based annotation library with rich controls, customization and serialization in mind
翻译准备中
正在加载完整 README。
查看完整 README ↗Web-based image annotation library with rich drawing controls, customizable annotation contexts, and built-in serialization.
Powered by OpenSeaDragon for deep zoom tiled image support and Fabric.js v7 for interactive canvas rendering, with official UI bindings for SolidJS and React. Draw rectangles, circles, lines, points, and freehand paths on gigapixel images with smooth pan and zoom.
DecorationProvider functions, recomputed at render time (never serialized)customControl overlay mode that routes raw pointer input to your own handler, used by the built-in two-axis exposure/contrast gesturenpm install @osdlabel/solid
npm install @osdlabel/react
import { render } from 'solid-js/web';
import { Annotator, createImageId, createAnnotationContextId } from '@osdlabel/solid';
import type { ImageSource, AnnotationContext } from '@osdlabel/solid';
const images: ImageSource[] = [
{
id: createImageId('slide-1'),
tileSource: 'https://example.com/slides/slide-1.dzi',
label: 'Slide 1',
},
];
const contexts: AnnotationContext[] = [
{
id: createAnnotationContextId('review'),
label: 'Review',
tools: [
{ type: 'rectangle', maxCount: 5, countScope: 'per-image' },
{ type: 'circle' },
{ type: 'point' },
],
},
];
function App() {
return (
<div style={{ width: '100vw', height: '100vh' }}>
<Annotator
images={images}
contexts={contexts}
showFilmstrip={true}
showGridControls={true}
showContextSwitcher={true}
onAnnotationsChange={(annotations) => console.log(annotations)}
/>
</div>
);
}
render(() => <App />, document.getElementById('app')!);
import { createRoot } from 'react-dom/client';
import { Annotator, createImageId, createAnnotationContextId } from '@osdlabel/react';
import type { ImageSource, AnnotationContext } from '@osdlabel/react';
// images and contexts defined the same way as above
function App() {
return (
<div style={{ width: '100vw', height: '100vh' }}>
<Annotator
images={images}
contexts={contexts}
showFilmstrip={true}
showGridControls={true}
showContextSwitcher={true}
onAnnotationsChange={(annotations) => console.log(annotations)}
/>
</div>
);
}
createRoot(document.getElementById('app')!).render(<App />);
The viewer registers the Fabric id custom property automatically when it
mounts, so there is no setup call to remember. initFabricModule() is still
exported and idempotent for advanced setups that build Fabric objects before any
viewer exists.
For more control, use the individual components and provider directly:
// SolidJS — the same names are exported from '@osdlabel/react'
import {
AnnotatorProvider,
useAnnotator,
Toolbar,
StatusBar,
GridView,
Filmstrip,
GridControls,
ContextSwitcher,
ViewControls,
serialize,
deserialize,
} from '@osdlabel/solid';
Wrap your UI in <AnnotatorProvider>, call useAnnotator() for access to state and actions, then compose Toolbar, GridView, Filmstrip, StatusBar, GridControls, ContextSwitcher, and ViewControls however you like.
Import everything from the single umbrella package you already depend on
(@osdlabel/solid, @osdlabel/react, or osdlabel). Types such as ImageId,
AnnotationId, and ImageSource physically live in lower-level subpackages, so
importing them from those paths only resolves when the subpackage is a direct
dependency of your app. The umbrella re-exports them all.
Reach for the granular packages only when building a custom UI layer, and add them as explicit dependencies:
import type { Annotation, Geometry } from '@osdlabel/annotation';
import type { ImageSource } from '@osdlabel/viewer-api';
import type { AnnotationContext } from '@osdlabel/annotation-context';
import { serialize, deserialize, applyAnnotationAction } from 'osdlabel';
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗