OpenComic AI Training generates paired training datasets by coordinating two distinct execution environments: Krita handles procedural comic-style art generation, and Node.js handles synthetic post-processing degradations. Every image that ends up in the dataset traces an identical two-phase path, ensuring that clean and degraded variants are always geometrically aligned and that every run is fully reproducible.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ollm/opencomic-ai-training/llms.txt
Use this file to discover all available pages before exploring further.
Two-Phase Pipeline
Node.js spawns Krita as a subprocess and connects to it over a WebSocket (port
49120) provided by the ollm/kra-remote plugin. Once connected, Node.js drives Krita entirely over this channel — creating documents, adding layers, setting brush presets, painting strokes, applying filter masks, and exporting pixel data.get_canvas_image: one before the halftone mask is visible (the clean image) and one after (feeding into the degraded pipeline).After Krita delivers the pixel buffers, Node.js applies a configurable sequence of sharp-based operations to the degraded buffer. These simulate the real-world quality losses that a trained model will eventually need to reverse:
Degraded Variants Per Clean Image
Each clean canvas render is expensive because it requires a full Krita paint pass. To amortize this cost,degradedImagesPerCleanImage controls how many independently randomized inNode degradation sequences are derived from the same clean render. For example, setting degradedImagesPerCleanImage: 100 produces 100 JPEG/WebP/resize/blur variants from a single Krita pass, giving 100 paired training examples at a fraction of the rendering cost.
Seeded Randomization
Every random decision in the pipeline — brush sizes, colors, halftone angles, compression qualities, resize scales — is driven by a deterministic PRNG seeded at generation time. The top-levelseed field anchors the global random stream. Each image then derives its own seed as:
seed and the same options file always produces identical output. It also means individual images can be audited or regenerated in isolation.
Krita brush stroke patterns depend on Krita’s internal state and may vary across sessions even with the same seed. The seed guarantees reproducibility of all JavaScript-side randomness, including which brushes and parameters are chosen.
Resuming a Stopped Run
Settingresume: true in the options file enables incremental generation. On startup the generator reads the first degradations[].output.clean directory, scans filenames to find the highest existing image number, and resumes from that image. Already-completed images are skipped without regeneration.
Preventing Krita Memory Leaks
Long generation runs can cause Krita’s memory footprint to grow unboundedly. The--restart-krita-every CLI flag instructs the generator to kill and relaunch Krita every N images, re-establishing the WebSocket connection after a short sleep. The default is 20 images.
Top-Level Options Reference
The following YAML block shows the key top-level fields that appear in every options file (taken fromoptions/template.yml):