API reference¶
inkterop is primarily a CLI, but the conversion pipeline is
importable. The authoritative description of the data model is the
IR specification — this page documents the code entry points.
Conversion pipeline¶
Cross-format conversion orchestration: read -> IR -> write.
parse_pages(spec, n)
¶
'1-3,7' -> zero-based page indices (bounds-checked).
Source code in core/src/inkterop/convert.py
read_input(in_path, cache_dir=None, pen_style='faithful')
¶
Read a file via the registry, or a library document by name/uuid.
Source code in core/src/inkterop/convert.py
convert(in_path, out_path, fidelity=Fidelity.EXACT, pages=None, experimental=False, force=False, cache_dir=None, options=None)
¶
Convert one document; returns the IR that was written.
Source code in core/src/inkterop/convert.py
Format registry¶
Format registry: one reader (native -> IR) / writer (IR -> native) each.
Plain module-level registration by explicit import — no plugin magic.
reader_for(path)
¶
Pick a reader: extension match first, confirmed by detect().
Source code in core/src/inkterop/formats/__init__.py
IR data model¶
The neutral ink document model.
Every format converts through this: reader (native -> Document) on one side, writer/renderer (Document -> native/PDF/SVG/...) on the other.
Coordinates stay in SOURCE units with a declared Page.point_scale
(units -> PDF points); writers scale as needed. Y grows downward.
Rect
dataclass
¶
Axis-aligned bounding box in source units.
Source code in core/src/inkterop/ir/model.py
Stroke
dataclass
¶
One pen stroke: parallel x/y point arrays plus optional per-point channels (pressure, tilt, width...), a semantic tool reference, and an optional exact appearance override. See the IR spec for the three-fidelity model.
Source code in core/src/inkterop/ir/model.py
TextBlock
dataclass
¶
A typed-text run anchored at (x, y) in source units.
Source code in core/src/inkterop/ir/model.py
RasterImage
dataclass
¶
Bitmap layer content (e.g. Supernote RLE layers, embedded images).
Source code in core/src/inkterop/ir/model.py
Layer
dataclass
¶
One z-ordered layer of a page: vector strokes, text, and/or a raster image.
Source code in core/src/inkterop/ir/model.py
TemplateBackground
dataclass
¶
Procedural page template, resolved to concrete params by the reader.
Source code in core/src/inkterop/ir/model.py
PdfBackground
dataclass
¶
ImageBackground
dataclass
¶
ColorBackground
dataclass
¶
Page
dataclass
¶
One page: bounds + unit scale, layers bottom-to-top, and an optional background.
Source code in core/src/inkterop/ir/model.py
Document
dataclass
¶
The root IR object a reader produces and a writer consumes.