Overview
OpenComic AI Bin provides a simple API for processing images with AI models. At its core, the library uses thepipeline 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 thepipeline 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
Basic options
TheOpenComicAIOptions 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, 4waifu2x-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 byrealcugan and waifu2x models:
0: No denoising1: Light denoising2: Medium denoising3: Heavy denoising
tileSize
Controls the tile size for processing. Smaller tiles use less VRAM but may be slower: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:Progress callbacks
Monitor the processing progress with a callback function: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
- Learn about pipeline processing to chain multiple models
- Explore model selection to choose the right model for your use case
- Discover daemon mode for faster batch processing