CISLab-HKUST/SketchKit

30

stars

312

commits

Python

primary language

Aug 25, 2026

updated

cislab.hkust-gz.edu.cn/projects/sketchkit/docs/

README

SketchKit

SketchKit is a Python toolkit for loading, representing, processing, and rendering digital sketches. It is designed for researchers studying sketch data and developers building sketch-based applications, with unified APIs for datasets, vectorization, stroke ordering, image generation, colorization, animation, and 3D modeling.

Documentation · Getting Started · API Reference

SketchKit Examples

Why SketchKit?

  • Unified sketch representation — work with different datasets through the same Sketch, Path, Curve, and Point hierarchy.
  • 14 built-in datasets — load popular sketch datasets on demand and filter samples through pandas metadata.
  • Composable sketch workflows — connect compatible datasets, processing methods, and renderers through a shared representation.
  • 2D and 3D rendering — rasterize vector strokes, render expressive brush strokes, or project 3D sketches from multiple camera views.
  • Research methods behind simple interfaces — use task-level APIs such as Vectorizer, Orderer, Colorizer, and Modeler.

Installation

SketchKit requires Python 3.12 or later and uses uv for dependency and environment management.

Install uv on macOS or Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

On Windows PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Clone or download this repository, then install the project environment:

git clone https://github.com/CISLab-HKUST/SketchKit.git
cd SketchKit
uv sync

Verify the installation:

uv run python -c "import sketchkit; print('SketchKit is ready')"

Quick Start

Load a dataset, retrieve a vector sketch, and render it to a PNG:

from sketchkit.datasets import OpenSketch
from sketchkit.renderer import CairoRenderer

dataset = OpenSketch()
sketch = dataset[0]

renderer = CairoRenderer()
image = renderer.render(sketch)
image.save("rendering.png")

Save the example as quickstart.py, then run:

uv run python quickstart.py

The script creates rendering.png. On first use, the OpenSketch adapter downloads its dataset automatically. Datasets are cached under ~/.sketchkit/datasets by default; pass root=... to choose another location, or cislab_source=True to use the CIS LAB mirror where supported.

For complete pipelines covering vectorization, animation, NPR rendering, and stylization, see the Getting Started guide.

Unified Sketch Representation

Built-in dataset adapters convert sketches to the same vector structure:

Sketch
└── Path
    └── Curve
        ├── Start Point
        ├── Control Point 1
        ├── Control Point 2
        └── End Point

A Sketch contains paths, each Path represents a continuous stroke, and each Curve is a cubic Bézier segment. Points store coordinates and can also carry pressure, thickness, color, opacity, and custom attributes.

Learn more in the representation guide.

Supported Datasets

SketchKit currently includes 14 dataset adapters:

  • LineDrawer
  • QuickDraw
  • ControlSketch
  • TU-Berlin
  • Tracing vs. Freehand
  • OpenSketch
  • SketchX-PRIS
  • Sketchy
  • PhotoSketching
  • GMU Sketch Cleanup
  • FS-COCO
  • DifferSketching
  • CreativeSketch
  • SketchIME

Download behavior, source availability, metadata, and original representation vary by dataset. Check the dataset guide and its dataset-specific pages before starting a large download.

All dataset classes expose items_metadata, a pandas DataFrame for filtering by fields such as category, split, and identifier:

from sketchkit.datasets import ControlSketch

dataset = ControlSketch()
bears = dataset.items_metadata[
    (dataset.items_metadata["category"] == "bear")
    & (dataset.items_metadata["split"] == "validation")
]
sketches = [dataset[row.id] for _, row in bears.head(100).iterrows()]

See the dataset guide for storage, lazy loading, metadata, and dataset-specific documentation.

Methods

SketchKit organizes methods around sketches as the central representation. The table lists implementations documented in this repository; availability and setup requirements vary by implementation.

TaskDocumented implementations
CleanupMasterSketch
VectorizationDeepVecSIG24, LineDrawer
Stroke orderingFu, LineDrawer
AnimationRIFE
StylizationNeuralBrushstroke
Image to sketchHED, PhotoSketch, SwiftSketch, AniLines
Sketch to imageControlNet, Pix2Pix, T2I-Adapter, Nano Banana 2
ColorizationControlNet Lineart, ControlNet Scribble, MangaNinja
3D modelingTeddy, SENS, Seed3D
Non-photorealistic renderingSuggestive Contours, Ridges and Valleys, Apparent Ridges

Some methods require pretrained weights, a CUDA-capable GPU, external services or credentials, or additional assets. Check the corresponding page in the methods guide before use.

Rendering

The rendering modules cover both 2D and 3D sketch visualization:

  • CairoRenderer rasterizes vector sketches with configurable canvas and stroke options.
  • CialloRenderer provides GPU-accelerated, brush-based vector stroke rendering.
  • DiffVGRenderer projects Sketch3D Bézier curves into one or more camera views.

See the 2D renderer guide and 3D renderer guide for examples and render options.

Documentation

The complete documentation is available at:

https://cislab.hkust-gz.edu.cn/projects/sketchkit/docs/

Useful entry points:

Contributing

Contributions for new datasets and processing methods are welcome. The manuals describe the expected unified interfaces, metadata conventions, module layout, tests, and GitHub workflow:

Contributors

MarkMoHR

86 commits

Euruson

60 commits

lfq1998-cg

20 commits

CISLab-HKUST/SketchKit

30

stars

312

commits

Python

primary language

Aug 25, 2026

updated

cislab.hkust-gz.edu.cn/projects/sketchkit/docs/

README

SketchKit

SketchKit is a Python toolkit for loading, representing, processing, and rendering digital sketches. It is designed for researchers studying sketch data and developers building sketch-based applications, with unified APIs for datasets, vectorization, stroke ordering, image generation, colorization, animation, and 3D modeling.

Documentation · Getting Started · API Reference

SketchKit Examples

Why SketchKit?

  • Unified sketch representation — work with different datasets through the same Sketch, Path, Curve, and Point hierarchy.
  • 14 built-in datasets — load popular sketch datasets on demand and filter samples through pandas metadata.
  • Composable sketch workflows — connect compatible datasets, processing methods, and renderers through a shared representation.
  • 2D and 3D rendering — rasterize vector strokes, render expressive brush strokes, or project 3D sketches from multiple camera views.
  • Research methods behind simple interfaces — use task-level APIs such as Vectorizer, Orderer, Colorizer, and Modeler.

Installation

SketchKit requires Python 3.12 or later and uses uv for dependency and environment management.

Install uv on macOS or Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

On Windows PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Clone or download this repository, then install the project environment:

git clone https://github.com/CISLab-HKUST/SketchKit.git
cd SketchKit
uv sync

Verify the installation:

uv run python -c "import sketchkit; print('SketchKit is ready')"

Quick Start

Load a dataset, retrieve a vector sketch, and render it to a PNG:

from sketchkit.datasets import OpenSketch
from sketchkit.renderer import CairoRenderer

dataset = OpenSketch()
sketch = dataset[0]

renderer = CairoRenderer()
image = renderer.render(sketch)
image.save("rendering.png")

Save the example as quickstart.py, then run:

uv run python quickstart.py

The script creates rendering.png. On first use, the OpenSketch adapter downloads its dataset automatically. Datasets are cached under ~/.sketchkit/datasets by default; pass root=... to choose another location, or cislab_source=True to use the CIS LAB mirror where supported.

For complete pipelines covering vectorization, animation, NPR rendering, and stylization, see the Getting Started guide.

Unified Sketch Representation

Built-in dataset adapters convert sketches to the same vector structure:

Sketch
└── Path
    └── Curve
        ├── Start Point
        ├── Control Point 1
        ├── Control Point 2
        └── End Point

A Sketch contains paths, each Path represents a continuous stroke, and each Curve is a cubic Bézier segment. Points store coordinates and can also carry pressure, thickness, color, opacity, and custom attributes.

Learn more in the representation guide.

Supported Datasets

SketchKit currently includes 14 dataset adapters:

  • LineDrawer
  • QuickDraw
  • ControlSketch
  • TU-Berlin
  • Tracing vs. Freehand
  • OpenSketch
  • SketchX-PRIS
  • Sketchy
  • PhotoSketching
  • GMU Sketch Cleanup
  • FS-COCO
  • DifferSketching
  • CreativeSketch
  • SketchIME

Download behavior, source availability, metadata, and original representation vary by dataset. Check the dataset guide and its dataset-specific pages before starting a large download.

All dataset classes expose items_metadata, a pandas DataFrame for filtering by fields such as category, split, and identifier:

from sketchkit.datasets import ControlSketch

dataset = ControlSketch()
bears = dataset.items_metadata[
    (dataset.items_metadata["category"] == "bear")
    & (dataset.items_metadata["split"] == "validation")
]
sketches = [dataset[row.id] for _, row in bears.head(100).iterrows()]

See the dataset guide for storage, lazy loading, metadata, and dataset-specific documentation.

Methods

SketchKit organizes methods around sketches as the central representation. The table lists implementations documented in this repository; availability and setup requirements vary by implementation.

TaskDocumented implementations
CleanupMasterSketch
VectorizationDeepVecSIG24, LineDrawer
Stroke orderingFu, LineDrawer
AnimationRIFE
StylizationNeuralBrushstroke
Image to sketchHED, PhotoSketch, SwiftSketch, AniLines
Sketch to imageControlNet, Pix2Pix, T2I-Adapter, Nano Banana 2
ColorizationControlNet Lineart, ControlNet Scribble, MangaNinja
3D modelingTeddy, SENS, Seed3D
Non-photorealistic renderingSuggestive Contours, Ridges and Valleys, Apparent Ridges

Some methods require pretrained weights, a CUDA-capable GPU, external services or credentials, or additional assets. Check the corresponding page in the methods guide before use.

Rendering

The rendering modules cover both 2D and 3D sketch visualization:

  • CairoRenderer rasterizes vector sketches with configurable canvas and stroke options.
  • CialloRenderer provides GPU-accelerated, brush-based vector stroke rendering.
  • DiffVGRenderer projects Sketch3D Bézier curves into one or more camera views.

See the 2D renderer guide and 3D renderer guide for examples and render options.

Documentation

The complete documentation is available at:

https://cislab.hkust-gz.edu.cn/projects/sketchkit/docs/

Useful entry points:

Contributing

Contributions for new datasets and processing methods are welcome. The manuals describe the expected unified interfaces, metadata conventions, module layout, tests, and GitHub workflow:

Contributors

MarkMoHR

86 commits

Euruson

60 commits

lfq1998-cg

20 commits

Languages

Python

100.0%