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.

All types described on this page are exported from the package’s compiled declarations file, dist/index.d.ts, referenced by the types field in package.json. Import them directly into TypeScript projects to get full type safety when configuring or extending the OpenComic AI Training pipeline.

Random-value types

These types form the building blocks for every randomisable field in the config. A field typed Rand can be a plain scalar, an array range, a weighted choice list, or a probability-gated value — all resolved at runtime by the rand module.

RandGenerator

The runtime random-number generator produced by rand.randByKey() or rand.uniqueRand(). It wraps a pure-rand xoroshiro128+ generator and exposes two high-level helpers.
import prand from 'pure-rand';

export interface RandGenerator {
  rng: prand.RandomGenerator;
  next: () => number;
  range: (from: number, to: number) => number;
}
RandGenerator instances are keyed by string in an internal map so the same key always returns the same generator object, preserving reproducible sequences across calls within a single run.

_Rand

The set of plain (non-object) values that a randomisable field may resolve to. This type is internal but underlies every public Rand variant.
type _Rand = boolean | number | [number, number] | number[] | string | string[];

ProbObject

An object that enables a value with an explicit numeric probability. When prob is evaluated the value is returned if the RNG fires, otherwise false is returned.
export interface ProbObject {
  prob: number;
  value: _Rand;
}

RandObject

A weighted or conditionally-gated value that can be placed in an array for weighted random selection.
export interface RandObject {
  value: _Rand;
  if?: string;
  weight?: number;
  prob?: Prob;
}

Rand

The top-level union of all valid randomisable value shapes. Any config field typed as Rand is resolved through rand.generate() before use.
export type Rand = _Rand | RandObject | ProbObject | RandObject[];
When a Rand field is an array of RandObject items that all carry weight, the rand.generate() function performs a weighted random draw. When prob is present on each item, rand.probFilter() is used to reduce the list first.

Prob

A probability gate. true/false bypass the RNG entirely; a number in [0, 1] is compared against the next RNG float.
export type Prob = boolean | number;

Drawing and processing types

Drawing

Union of all recognised procedural drawing layer types.
export type Drawing =
  | 'lineart'
  | 'background'
  | 'texture'
  | 'multiline-draw'
  | 'colorize-mask'
  | 'paint'
  | 'lineart-texture'
  | 'lineart-random'
  | 'dots'
  | 'lines';

Processing

Union of all recognised post-processing operation types.
export type Processing =
  | 'halftone'
  | 'noise'
  | 'blur'
  | 'resize'
  | 'texture-image'
  | 'layer-blur';

Degradation

The two supported lossy compression formats for the TypeScript type. Note that the runtime inNode pipeline in sharp.mts also handles 'avif', 'jxl', 'rotate', and 'resize' as degradation operation types, but those are not part of the TypeScript Degradation union.
export type Degradation = 'jpeg' | 'webp';

Kernel

Re-export of sharp’s KernelEnum, used by ProcessingOption.kernel.
export type Kernel = KernelEnum;

DegradationObject

Configures a single compression-based degradation step that can be applied with a probability gate.
export interface DegradationObject {
  type: Degradation;
  prob: Prob;
  quality?: Rand;
}

ProcessingOption

Describes a single post-processing or final-processing step in the pipeline. The type determines which sharp operation is invoked.
export interface ProcessingOption {
  type: Processing;
  prob: Prob;
  size?: Rand;
  gray?: Rand;
  scale?: Rand;
  skipIf?: string[];
  kernel?: Rand;
  blurUp?: Rand;
  blurDown?: Rand;
}

Main options type

Options

The top-level configuration object loaded from a YAML file by options.load(). All Rand fields are resolved per-image by options.randomize() before drawing begins.
export interface Options {
  seed: number;
  resume: boolean;
  images: number;
  degradedImagesPerCleanImage: number;

  // Runtime fields — set by options.load() and options.setCurrentImageRand()
  mainRand?: RandGenerator;
  imageSeed?: number;
  currentImageRand?: RandGenerator;
  currentImage?: number;
  currentImagePalette?: Color[];
  groupLayer?: string;
  groupLayers?: string[];

  // Static config fields
  base: {
    scale: number;
    disableBrushesWithPixelatedEdges?: boolean;
    disableBrushesWithPixelatedEdgesInSmallSize?: boolean;
    halftone: {
      angle: Rand;
    };
    size: {
      width: Rand;
      height: Rand;
    };
    colored: {
      prob: Prob;
    };
  };

  drawings: {
    type: Drawing;
    file: string;
    amount: Rand;
  }[];

  postProcessing: ProcessingOption[];
  finalProcessing: ProcessingOption[];

  degradations: {
    name: string;
    type: Degradation;
    output: {
      clean: string;
      degraded: string;
      options: string;
    };
    list: DegradationObject[];
  }[];
}
Runtime fields (mainRand, imageSeed, currentImageRand, currentImage, currentImagePalette, groupLayer, groupLayers) are injected by options.load() and options.setCurrentImageRand(). They are undefined until those functions have been called.

Color and palette types

Color

An RGBA color value. The optional gray channel is used to set all three RGB channels to the same value when a grayscale shorthand is needed.
export interface Color {
  r: number;
  g: number;
  b: number;
  a?: number;
  gray?: number;
}

ColorObject

An entry in a colour palette, combining a palette index, a display name, and the resolved Color.
export interface ColorObject {
  index: number;
  name: string;
  color: Color;
  rgb?: Color;
}

ColorGroup

A lazily evaluated colour accessor. Calling color() returns a Color at resolution time, enabling deferred palette lookups.
export type ColorGroup = {
  color: () => Color;
};

Layer and area types

Area

The vertical region of a document that a layer occupies. Used with 3layered drawing mode.
export type Area = 'all' | 'up' | 'middle' | 'down';

Layers

A sparse record mapping each Area to an arbitrary key-value map of per-area drawing results (e.g. lineart point arrays, halftone configs).
export type Layers = Partial<Record<Area, Record<string, any>>>;

Drawing result type

Drawings

The runtime output record produced after a drawing pass. Consumed by downstream degradation and output steps.
export interface Drawings {
  type: Drawing;
  points?: number[];
  color?: Color;
  data?: any;
}

Brush preset type

PresetCategory

Union of all brush category identifiers recognised by the Krita preset parser.
export type PresetCategory =
  | 'eraser'
  | 'airbrush'
  | 'basic'
  | 'pencil'
  | 'ink'
  | 'marker'
  | 'bristles'
  | 'dry'
  | 'chalk'
  | 'charcoal'
  | 'wet'
  | 'watercolor'
  | 'blender'
  | 'adjustment'
  | 'rgba'
  | 'shapes'
  | 'pixel-art'
  | 'clone-distort'
  | 'sketching'
  | 'texture'
  | 'filter'
  | 'screentone'
  | 'stamp';
PresetCategory values map directly to the letter prefix used in Krita’s default brush preset naming scheme (e.g. 'ink' matches presets like "d) Ink-1 Precision"). The krita module uses these categories to filter the brush list when randomising brush selection.

Build docs developers (and LLMs) love