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.

Options files are YAML documents loaded by the options.load() function at startup. The loader reads the root file, recursively resolves every file: key it encounters by merging the referenced YAML content with any sibling keys present in the parent, and then hands the fully-assembled object to the rest of the pipeline. This composition system lets you split shared configuration into reusable blocks stored under options/common/ and override individual fields per-preset without duplicating the whole file.

The Rand Type

Many fields accept a Rand value — a flexible union that the randomizer resolves once per image. The TypeScript definition is:
type _Rand = boolean | number | [number, number] | number[] | string | string[];

export interface ProbObject {
  prob: number;
  value: _Rand;
}

export interface RandObject {
  value: _Rand;
  if?: string;
  weight?: number;
  prob?: Prob;
}

export type Rand = _Rand | RandObject | ProbObject | RandObject[];
export type Prob = boolean | number;
A plain scalar value — always used as-is.
scale: 0.5
angle: 45
A two-element numeric array. The randomizer picks a uniformly distributed value in [min, max], including decimal values when the bounds are non-integer.
quality: [30, 100]
angle: [42.1, 47.9]
An array of objects, each with a value and a relative weight. Weights are not probabilities — they are summed and each entry is sampled proportionally. value may itself be a range.
scale:
  - value: [0.20, 0.999]
    weight: 4.0
  - value: [1.001, 1.20]
    weight: 1.0
An object with a prob key between 0.0 and 1.0. When the randomizer evaluates this node, the wrapped feature is enabled with that probability and disabled otherwise.
colored:
  prob: 0.2
An array of objects each containing an if condition string and a value. Conditions are evaluated in order; the first match wins. The special condition "default" always matches and acts as a fallback. Condition strings follow the pattern "key operator rvalue" where operator is one of ==, ===, !=, !==, <, >, <=, >=, or typeof. The key uses dot notation to reference a previously resolved value in the option tree (e.g. inKrita.halftone.config.size).
scale:
  - value: [0.27, 0.31]
    if: inKrita.halftone.config.size >= 9.2
  - value: [[0.65, 0.70], [0.47, 0.54], [0.29, 0.39]]
    if: inKrita.halftone.config.size >= 7.8
  - value: [1, [0.4, 1.08]]
    if: default

Top-Level Fields

seed
number
required
Base integer seed used to initialize the main random generator. All per-image seeds are derived deterministically from this value combined with the image index, so the same seed always reproduces the same sequence of images. Note that Krita brush patterns may still vary across sessions independent of this seed.
resume
boolean
default:"false"
When true, the pipeline skips images that already exist in the output directories and continues from where it left off. Useful for resuming interrupted runs without regenerating completed images.
images
number
Number of distinct clean images to generate. The total number of output image pairs is images × degradedImagesPerCleanImage.
degradedImagesPerCleanImage
number
How many degraded variants to produce for each clean image. Each variant applies the degradation pipeline independently with freshly randomized parameters.
The format field (jpg or png) is read from the YAML config file by the pipeline but is not declared in the TypeScript Options interface. It is treated as a plain config-file-only field. Set it at the top level of your options file:
format: jpg   # or: png
base
object
Base image settings that apply globally before any degradation pipeline runs.
base.scale
number
default:"1"
A global multiplier applied to all size values. For example, setting scale: 2 with size: [250, 1000] effectively yields size: [500, 2000].
base.disableBrushesWithPixelatedEdges
boolean
default:"false"
When true, brushes known to produce pixelated edges are excluded from brush selection. Recommended for upscaling and artifact-removal datasets where such edges would corrupt the training signal.
base.disableBrushesWithPixelatedEdgesInSmallSize
boolean
default:"false"
Same exclusion as above, but only applied when the canvas is at a small size.
base.size
object
Controls canvas dimensions. The TypeScript interface defines width and height as Rand values. In practice, YAML presets also use a size shorthand for square canvases and a multiple key to snap dimensions to a given integer, which the pipeline resolves before constructing the canvas.
size:
  size: [250, 1000]   # square canvas, side chosen uniformly in this range
  multiple: 2         # dimension rounded to nearest multiple of 2
base.halftone
object
Halftone settings for the base image, primarily the screentone angle that Krita applies when rendering halftone layers. angle is a Rand value — typically a weighted list biased toward 45°.
halftone:
  angle:
    - value: 45
      weight: 5.0
    - value: [42.1, 47.9]
      weight: 1.0
    - value: 0
      weight: 1.0
base.colored
object
Probability that the generated image uses a color palette instead of grayscale.
colored:
  prob: 0.2
drawings
array | object
The list of drawing layer types and amounts composited to produce the clean image. In practice this field is almost always a file: reference to options/common/drawings.yml, which defines the full set of drawing types (lineart, background, texture, colorize-mask, paint, lineart-texture, lineart-random, dots, lines, etc.) and their brush, size, and point-count parameters.
drawings:
  file: 'options/common/drawings.yml'
postProcessing
array
Post-processing operations applied to the rendered Krita canvas after all drawing layers have been composited. Currently defined types include texture-image and layer-blur. These are applied inside Krita before the image is exported for Node.js processing.
postProcessing:
  - type: layer-blur
    prob: 0.1
    blurUp: [50, 100]
    blurDown: [10, 50]
finalProcessing
array
Final processing steps run after all degradations have been applied. Supported types include noise.
finalProcessing:
  - type: noise
    prob: 0.1
    size: [0.5, 5.0]
    gray: [5.1, 29.9]
degradations
array
An array of degradation pipeline definitions. Each entry describes one dataset to generate — its output directories, Krita-side operations, and Node.js-side operations. Multiple entries can coexist in a single options file to produce several datasets in one run.

The degradations[] Block

Each entry in the degradations array defines one complete dataset pipeline.
degradations[].name
string
A human-readable identifier for the dataset. Used in logging and is reflected in the default output directory names.
degradations[].output
object
Paths to output directories. All three directories are created automatically if they do not exist.
degradations[].output.clean
string
Directory where clean (ground-truth) images are written.
degradations[].output.degraded
string
Directory where degraded images are written.
degradations[].output.options
string
Optional directory where per-image JSON option snapshots are saved for inspection or debugging.
degradations[].inKrita
array
Operations executed inside Krita on the rendered canvas before it is exported to Node.js. Currently the only supported type is halftone.
degradations[].inKrita[].type
string
Must be halftone.
degradations[].inKrita[].prob
Prob
Probability that this Krita operation is applied.
degradations[].inKrita[].singleRun
boolean
default:"false"
When true, halftone is applied only once and reused across all degraded variants of the same clean image. This reduces Krita processing time significantly but means all variants share the same screentone.
degradations[].inKrita[].sameInAllLayers
boolean
default:"false"
When true, the same halftone parameters are used for every layer (all, up, middle, down). Required when you reference inKrita.halftone.config.size in a conditional Rand expression for the Node.js resize step.
degradations[].inKrita[].file
string
Path to a halftone preset YAML file (e.g. options/common/halftone-hard.yml).
degradations[].inKrita[].applyIn
Rand
Controls whether halftone is applied to the degraded image only (degraded), both clean and degraded (both), or neither (without).
degradations[].inNode
array
Node.js-side operations applied to the exported image. Steps run sequentially by default (or in parallel if inNodePromiseAll is set). Each step object has at minimum a type and prob field. Supported types:
  • resize — Scale the image. scale is a Rand; kernel picks the resampling filter; both: true applies the resize to both clean and degraded, both: false applies it to degraded only. A nested clean: sub-object can specify separate kernel options for the clean copy.
  • rotate — Rotate both clean and degraded images by the same angle (in degrees). background sets the fill color for exposed corners. skipIf prevents a second rotation from being applied if an earlier step already rotated the image.
  • jpeg — Re-encode to JPEG at randomized quality.
  • webp — Re-encode to WebP at randomized quality.
  • avif — Re-encode to AVIF at randomized quality.
  • jxl — Re-encode to JPEG XL at randomized quality.
  • blur / resize-blur — Apply Gaussian blur or a combined resize-then-blur step. Both types accept a sigma or scale range.
  • group — Apply a list of sub-steps together, gated by a single prob.
Steps sourced from common blocks can be inlined using file::
inNode:
  - file: 'options/common/blur.yml'
degradations[].inNodePromiseAll
boolean
default:"false"
When true, all inNode steps are launched in parallel with Promise.all. This is faster but is not compatible with conditional Rand expressions that reference previously resolved values (such as if: inKrita.halftone.config.size >= ...) when singleRun is disabled.
degradations[].checkSizes
boolean
default:"false"
After each image pair is written, verifies that the clean image dimensions are equal to the degraded dimensions multiplied by the expected upscale factor. Enables detection of cases where different resize kernels for clean and degraded images have produced mismatched outputs.

Minimal Complete Example

The following is a minimal but fully functional options file that generates a small 2× upscale dataset:
seed: 42
resume: true
images: 100
degradedImagesPerCleanImage: 5
format: jpg

base:
  scale: 1
  disableBrushesWithPixelatedEdges: true
  file: options/common/base.yml
  size:
    size: [256, 512]
    multiple: 2
  halftone:
    angle:
      - value: 45
        weight: 5.0
      - value: [42.1, 47.9]
        weight: 1.0
  colored:
    prob: 0.2

drawings:
  file: options/common/drawings.yml

degradations:

  - name: my-upscale-2x
    output:
      clean: datasets/my-upscale-2x/clean
      degraded: datasets/my-upscale-2x/degraded
      options: datasets/my-upscale-2x/options
    inKrita:
      - type: halftone
        prob: 1.0
        singleRun: false
        sameInAllLayers: true
        file: options/common/halftone-upscale.yml
    inNode:
      - type: resize
        prob: 1.0
        both: false
        scale: 0.5
        kernel: [linear, cubic, mitchell, lanczos3]
      - type: jpeg
        prob: 0.5
        quality: [40, 95]
      - file: options/common/blur.yml
    checkSizes: false
The file: key works at any depth. When the loader encounters it inside an object, it reads the referenced YAML, merges it with the sibling keys in the parent, then removes the file: key from the merged result. When encountered inside an array element, the file content is expanded in place. Local keys always take precedence over the referenced file’s keys.

Build docs developers (and LLMs) love