Skip to main content

Overview

OpenComic AI Bin provides a simple API for processing images with AI models. At its core, the library uses the pipeline method to process images through one or more AI models.

Setting up the library

Before processing images, you need to configure the library with the necessary paths:

Electron apps

For Electron applications, you may need to adjust the binary directory to point to the unpacked asar location:

Processing a single image

To process an image with a single model, use the pipeline method with one step:

Supported image formats

OpenComic AI Bin supports a wide range of image formats:
  • Common formats: jpg, jpeg, jpe, png, webp
  • TIFF formats: tif, tiff
  • Bitmap formats: bmp, dib
  • HDR formats: exr, hdr
  • PNM formats: pbm, pgm, ppm, pnm, pxm
  • Other formats: pic, ras, sr
The output format is determined by the file extension of the destination path.

Basic options

The OpenComicAIOptions interface provides several options to control image processing:

model

The AI model to use for processing. See the model selection guide for details on available models.

scale

The upscaling factor. Different models support different scale values:
  • realcugan: 2, 3, 4
  • waifu2x-models-cunet: 2, 4, 8, 16, 32
  • Most upscayl models: 2, 3, 4
  • Descreen and artifact-removal models: 1 (no scaling)
If you specify a scale value not supported by the model, the library will automatically select the closest available scale.

noise

Noise reduction level (0-3). Only supported by realcugan and waifu2x models:
  • 0: No denoising
  • 1: Light denoising
  • 2: Medium denoising
  • 3: Heavy denoising

tileSize

Controls the tile size for processing. Smaller tiles use less VRAM but may be slower:
Reduce tile size if you encounter out-of-memory errors on your GPU.

gpuId

Specify which GPU to use for processing (useful for multi-GPU systems):

threads

Number of CPU threads to use for processing:

tta

Enable Test-Time Augmentation for potentially better quality at the cost of 8x slower processing:
TTA mode significantly increases processing time. Only use it when you need the highest possible quality.

Progress callbacks

Monitor the processing progress with a callback function:
The progress parameter is a value between 0 and 1, where 1 represents 100% completion.

Download callbacks

If a model is not available locally, it will be downloaded automatically. You can monitor the download progress:

Complete example

Here’s a complete example demonstrating single-model processing with all available options:

Next steps