LineDrawer¶
LineDrawer is a SketchDataset loader for the LineDrawer dataset, where the sequential drawing process of high-quality anime line arts is stored as .json files. The loader extracts coordinate points and dynamic point-level thickness, converting them into a Sketch composed of Paths and cubic Bézier Curves. The canvas dimensions are dynamically calculated based on the bounding box of the strokes to ensure no clipping occurs.
Source: datasets/linedrawer.py
Data Format¶
Each sample is a JSON array of strokes, where each stroke contains a sequence of points with the following attributes:
x: x-coordinate (float)y: y-coordinate (float)w: local stroke thickness/width at the current point (float)t: time stamp
The loader groups these points into strokes and converts each consecutive point pair into a cubic Bézier curve, applying the w attribute to the thickness of the corresponding Point.
Directory Layout¶
After download and extraction, the dataset is expected under:
<root>/
LineDrawer/
json/
00000.json
00001.json
...
Each
.jsonfile in thejson/directory corresponds to a single sketch.
Code¶
from sketchkit.datasets import LineDrawer
ds = LineDrawer(cislab_source=True)
sketch = ds[0]
print(sketch.width, sketch.height)
print(sketch.path_num, sketch.curve_num)
Arguments
cislab_source: Selects the download source. IfTrue, the dataset is downloaded from the CISLAB CDN mirror; otherwise it is downloaded from official host.CISLAB mirror :
https://cislab.hkust-gz.edu.cn/projects/sketchkit/datasets/LineDrawer/sketch.zipOfficial host:
https://cislab.hkust-gz.edu.cn/projects/linedrawer/datasets/sketch.zip