Skip to main content

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.

The generate command is the primary entry point for producing paired training datasets. It launches Krita in the background via the kra-remote plugin, reads a YAML options file describing how synthetic degradations should be applied, and writes matching clean and degraded image pairs to the configured output folder. Each run progresses through the full image count specified in the options file, automatically managing Krita restarts to avoid memory leaks and resuming from where it left off if a previous run was interrupted.

Invocation

npm run prepare && npm run generate -- --options <file> --krita <path> [flags]

Why npm run prepare must run first

The generate script executes the compiled output at ./dist/index.mjs, not the raw TypeScript source. Running npm run prepare first invokes the TypeScript compiler (tsc) and then bundles the output with Rollup, placing the ready-to-run module in dist/. Skipping this step means any recent source changes will not be reflected — or the dist/ directory may not exist at all on a fresh clone.
# Compile TypeScript + bundle with Rollup
npm run prepare

# Then run the generator
npm run generate -- --options ./options/opencomic-ai-upscale-2x.yml --krita ./krita-5.3.1-x86_64.AppImage

Flags

--options
string
required
Path to the YAML options file that defines the dataset configuration. Options files for the official OpenComic AI presets live in the options/ directory (e.g. ./options/opencomic-ai-upscale-2x.yml). The file controls image count, degraded-images-per-clean-image ratio, degradation parameters, and output paths.
--krita
string
required
Path to the Krita executable or AppImage. Krita 5.3.0 or later is required, and the ollm/kra-remote plugin must be installed in that Krita instance. Both an installed binary and a standalone AppImage are accepted.
--krita ./krita-5.3.1-x86_64.AppImage
--krita /usr/bin/krita
--restart-krita-every
number
Restart the Krita process every N clean images to prevent unbounded memory growth during long generation runs. Defaults to 20 if not specified. Increasing this value may improve throughput on systems with ample RAM; lowering it can help on memory-constrained machines.
--print-options
flag
Print the fully resolved (post-randomization) options object to stdout — first as a plain object, then as a JSON string — and exit immediately. No images are generated. Useful for inspecting exactly which parameter values were sampled for a given options file before committing to a full run.
--print-krita-filters
flag
Connect to the running Krita instance, query the filter properties for the opencomic:gradient:filter filter (using the gradientmap filter type) via the kra-remote plugin, print the result to stdout, and exit. Requires --krita and --options to be provided so the plugin connection can be established.
--print-krita-gradients
flag
Connect to the running Krita instance, print all available gradient resources retrieved from Krita via the kra-remote plugin, and exit. Requires --krita and --options to be provided.
--help / -h
flag
Print the built-in help message showing usage syntax and a summary of all arguments, then exit. Triggered automatically when --options or --krita are missing.

Progress output

While generating, the CLI renders a single-line progress bar that is continuously updated in place:
Generating Images | ████████████░░░░░░░░ | 62% | 62/100 Clean Images | 310/500 Final Images (Images × Degraded) | Speed: 1.84 img/s | Elapsed: 00:33 | Remaining: 00:20
FieldDescription
Bar + percentageFraction of clean images completed
{value}/{total} Clean ImagesCurrent clean image index out of the total defined in the options file
{degradedImages}/{totalDegradedImages} Final ImagesTotal degraded images written so far out of images × degradedImagesPerCleanImage
SpeedRolling average generation rate in images per second (averaged over the last degradedImagesPerCleanImage × 10 samples)
ElapsedWall-clock time since the run started (duration_formatted)
RemainingETA based on current rolling speed (eta_formatted)

Error behavior

If the generator cannot connect to the Krita plugin after launching Krita, it prints the following message and exits with code 1:
Failed to connect to Krita plugin! Make sure the Krita plugin is running and try again.
Verify that:
  • The kra-remote plugin is installed and enabled in the Krita instance pointed to by --krita.
  • No other Krita process is blocking the plugin’s communication channel.
  • The Krita version is 5.3.0 or later.

Example commands

1. Generate an upscale-2x dataset using the official preset:
npm run prepare && npm run generate -- \
  --options ./options/opencomic-ai-upscale-2x.yml \
  --krita ./krita-5.3.1-x86_64.AppImage
2. Generate an artifact-removal dataset with a custom Krita restart interval:
npm run prepare && npm run generate -- \
  --options ./options/opencomic-ai-artifact-removal.yml \
  --krita ./krita-5.3.1-x86_64.AppImage \
  --restart-krita-every 50
3. Print the resolved options for a descreen configuration without generating any images:
npm run prepare && npm run generate -- \
  --options ./options/opencomic-ai-descreen-hard.yml \
  --krita ./krita-5.3.1-x86_64.AppImage \
  --print-options
The --dev flag is an internal testing shortcut. When present, the generator produces exactly one image and then exits immediately, skipping the rest of the run. It is intended only for rapid development iteration and should not be used for actual dataset generation.

Build docs developers (and LLMs) love