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.
OpenComic AI Training applies degradations in two distinct stages: first inside Krita (halftone patterns rendered as filter masks on the canvas), and then inside Node.js (codec compression, spatial resampling, blur, and rotation applied via the sharp image processing library). Each stage targets a different class of real-world comic quality degradation that the trained models will be expected to reverse.
Stage 1 — inKrita Degradations
The only inKrita degradation type currently in use is halftone. It is implemented by adding Krita’s built-in halftone filter as a filter mask on the painted layers, rendering the classic dot or line screen patterns found in offset-printed comics and manga.
halftone
Krita’s halftone filter is configurable across several dimensions:
colorSpace — RGBA (grayscale intensity-based screen) or CMYKA (per-channel CMYK screens, producing the characteristic color moiré of color comics).
pattern — dots or lines.
size — the dot/line cell size in pixels (e.g., [2.5, 9.99]).
mode — intensity (brightness-based threshold) or independent_channels (each CMYK channel screened independently).
shapes — dot, elipse, diamond, or square.
interpolation — lineal or sinusoidal.
applyIn — whether to apply the halftone only to the degraded canvas, to both clean and degraded, or without (skip entirely). When applied only to the degraded canvas the clean image has no halftone, which is the standard training target for descreening models.
singleRun — when true, the halftone is computed once and reused for all degradedImagesPerCleanImage variants of the same clean image, reducing Krita processing time significantly.
sameInAllLayers — when true, all drawing layers receive identical halftone parameters (required when the size field is referenced by downstream if conditions in inNode).
inKrita:
- type: halftone
prob: 1.0
singleRun: true
sameInAllLayers: true
file: options/common/halftone-hard.yml
applyIn:
- value: without
weight: 10.0
- value: both
weight: 1.0
colored:
colorSpace:
- value: 'RGBA'
weight: 1.0
- value: 'CMYKA'
weight: 5.0
both:
pattern: dots
size: [2.5, 9.99]
mode: independent_channels
Stage 2 — inNode Degradations
After Krita delivers the pixel buffers, Node.js applies a sequential list of sharp-based operations to the degraded image buffer (and sometimes to both clean and degraded). Each step in the inNode list is evaluated independently.
Common Fields
Every inNode step supports these shared fields:
| Field | Description |
|---|
type | The operation type (rotate, resize, resize-blur, jpeg, webp, avif, jxl, blur, group). |
prob | Probability (0.0–1.0) that this step is applied to a given image. prob: 1 means always apply; prob: 0.5 means apply 50% of the time. |
skipIf | List of step types. If any of the listed types have already been applied in the current degradation sequence, this step is skipped entirely. |
rotate
Applies a rotation to both the clean and degraded images, keeping the pair geometrically aligned. The output canvas is cropped to a multiple of base.size.multiple if set.
| Parameter | Description |
|---|
angle | Rotation angle in degrees. Can be a fixed number or a range [min, max]. |
background | Fill color for the corners exposed after rotation (hex string, e.g., '#ffffff'). |
- type: rotate
prob: 0.2
angle: [-45, 45]
background: '#ffffff'
Because rotation is applied to both images, it does not introduce any misalignment between the clean and degraded pair. It is used to improve the model’s rotation invariance.
resize
Resizes the degraded image (and optionally the clean image) using the specified scale factor and interpolation kernel. The minimum output dimension is clamped to 64 pixels.
| Parameter | Description |
|---|
scale | Scale factor. Values below 1.0 shrink the image; values above 1.0 enlarge it. Can be a fixed number, a range, or a weighted list. |
kernel | Interpolation kernel. Standard sharp kernels: nearest, linear, cubic, mitchell, lanczos2, lanczos3, mks2013, mks2021. Affine-based kernels (applied via sharp.affine): bicubic, bilinear, nohalo, lbb, vsqbs. Can be a single value or a list to pick from randomly. |
both | When true, the clean image is also resized using the same scale (useful for artifact removal where output resolution must match input). When false, only the degraded image is resized (the standard setup for upscaling). |
clean.kernel | Optional override kernel list used only when resizing the clean image. Useful for avoiding moiré when the clean image should not use the same aggressive downsampling kernel as the degraded image. |
- type: resize
prob: 1
both: false
scale: 0.5
kernel: [linear, cubic, mitchell, lanczos2, lanczos3, mks2013, mks2021,
bicubic, bilinear, nohalo, lbb, vsqbs]
resize-blur
Resizes the image down and then back up to the original size using the same kernel, simulating the softening introduced by low-resolution intermediate processing. The resize-down and resize-up share the same scale and kernel parameters as resize.
| Parameter | Description |
|---|
scale | Intermediate scale factor applied before restoring the original size. Values below 1.0 produce the typical blur-like softening effect. Can be a fixed number, a range, or a weighted list. |
kernel | Interpolation kernel used for both the down and up resize passes. Accepts the same values as resize. |
both | When true, applies the operation to both clean and degraded images. |
- type: resize-blur
prob: 1
scale: [0.3, 1.50]
kernel: cubic
jpeg
Encodes the degraded image as JPEG at a random quality level and decodes it back to a pixel buffer, introducing DCT block artifacts, color subsampling, and ringing at edges.
| Parameter | Description |
|---|
quality | JPEG quality (1–100). Can be a fixed integer or a range [min, max]. |
- type: jpeg
prob: 0.8
quality: [30, 100]
webp
Encodes and decodes using the WebP lossy codec. Produces different artifact patterns from JPEG — smoother blocks but potential smearing around fine lines.
| Parameter | Description |
|---|
quality | WebP quality (1–100). Can be a fixed integer or a range [min, max]. |
- type: webp
prob: 0.1
quality: [30, 100]
avif
Encodes and decodes using the AVIF codec (AV1-based). Produces strong compression at low bitrates with characteristic block-like degradation in high-frequency regions.
| Parameter | Description |
|---|
quality | AVIF quality (1–100). Can be a fixed integer or a range [min, max]. |
- type: avif
prob: 0.1
quality: [30, 100]
jxl
Encodes and decodes using JPEG XL. Can produce both ringing and smooth-area compression artifacts depending on the quality level.
| Parameter | Description |
|---|
quality | JXL quality (1–100). Can be a fixed integer or a range [min, max]. |
- type: jxl
prob: 0.1
quality: [30, 100]
blur
Applies a Gaussian blur with integer-precision approximation. Used to simulate out-of-focus scanning or low-pass pre-filtering.
| Parameter | Description |
|---|
sigma | Standard deviation of the Gaussian kernel. Can be a fixed number or a range [min, max]. |
both | When true, applies the blur to both clean and degraded images. |
The shared options/common/blur.yml fragment used across presets demonstrates single and double blur passes:
- type: blur
prob: 0.1
sigma: [0.3, 0.5]
- type: group
prob: 0.05
list:
- type: blur
prob: 1
sigma: [0.3, 0.4]
- type: blur
prob: 1
sigma: [0.3, 0.4]
group
A meta-type that inlines a nested list of steps into the current degradation sequence. When a group step is reached, all entries in its list are inserted at the front of the remaining steps and evaluated in order. This allows reusable step bundles to be shared via file: includes.
| Parameter | Description |
|---|
prob | Probability that the entire group is expanded and applied. When the group is skipped, none of its child steps run. |
list | Array of inNode step objects to expand into the sequence when the group runs. |
- type: group
prob: 0.05
list:
- type: blur
prob: 1
sigma: [0.3, 0.4]
- type: blur
prob: 1
sigma: [0.3, 0.4]
Stacking and Sequencing
Multiple steps of the same type can appear in the inNode list — this is intentional. For example, the artifact removal preset applies up to five independent JPEG passes to simulate the cumulative re-saves common in low-quality scans:
inNode:
- type: jpeg
prob: 0.8
quality: [30, 100]
- type: jpeg # possible second pass
prob: 0.1
quality: [30, 100]
- type: jpeg # possible third pass
prob: 0.1
quality: [30, 100]
skipIf — Conditional Skipping
A step with skipIf is skipped if any of the listed step types have already run in the current degradation sequence. This prevents applying conflicting or redundant operations. For example, to prevent a large rotation from being applied when a small rotation was already used earlier:
- type: rotate
prob: 0.05
skipIf: [null, rotate] # Skip if a 'rotate' step already ran
angle: [-45, 45]
background: '#ffffff'
null in the skipIf list is a placeholder that matches nothing — it is included by convention to make the YAML list syntax unambiguous when only one type is listed.
inNodePromiseAll — Parallel Execution
When inNodePromiseAll: true is set on a degradation block, all degradedImagesPerCleanImage variants of a single clean image are processed in parallel using Promise.all, rather than sequentially. This can significantly speed up throughput on multi-core machines.
degradations:
- name: opencomic-ai-artifact-removal
inNodePromiseAll: true # All 100 degraded variants processed in parallel
inNode:
# ...
inNodePromiseAll: true is incompatible with steps that use if conditions referencing Krita-side values (e.g., if: inKrita.halftone.config.size >= 9.2) when singleRun is disabled. In those cases, set inNodePromiseAll: false to ensure each variant’s condition is evaluated against its own Krita state.