Skip to main content
This guide will help you get OpenComic AI Bin up and running quickly.

Installation

1

Install the package

Install opencomic-ai-bin via your preferred package manager:
npm install opencomic-ai-bin
The package includes pre-built binaries for Linux, macOS, and Windows on both x64 and ARM64 architectures.
2

Configure the library

Set up the models directory and configure paths:
import OpenComicAI from 'opencomic-ai-bin';

// Set the directory where models will be stored
OpenComicAI.setModelsPath('./models');

// For Electron apps, adjust the binary path to point to unpacked resources
OpenComicAI.setDirname(
  OpenComicAI.__dirname.replace(/app(-(?:arm64|x64))?\.asar/, 'app$1.asar.unpacked')
);
Models are downloaded automatically on first use. The setModelsPath method configures where these models are stored locally.
3

Process your first image

Use the pipeline method to upscale an image:
await OpenComicAI.pipeline(
  './input.jpg',
  './output.jpg',
  [
    {
      model: 'realcugan',
      scale: 4,
      noise: 0
    }
  ],
  (progress) => {
    console.log(`Processing: ${Math.round(progress * 100)}%`);
  }
);

console.log('Image upscaled successfully!');
This example uses the RealCUGAN model to upscale an image 4x with no noise reduction.

Multi-step processing

You can chain multiple models together for advanced workflows:
import OpenComicAI from 'opencomic-ai-bin';
import sharp from 'sharp'; // Optional: for ICC profile support

(async () => {
  // Configure
  OpenComicAI.setModelsPath('./models');
  OpenComicAI.keepIccProfile(sharp); // Preserve color profiles

  // Process with multiple steps
  await OpenComicAI.pipeline(
    './input.jpg',
    './output.jpg',
    [
      {
        model: '1x_halftone_patch_060000_G', // Remove halftone patterns
      },
      {
        model: 'realcugan', // Then upscale
        scale: 4,
        noise: 0,
      }
    ],
    (progress) => {
      console.log(`Processing: ${Math.round(progress * 100)}%`);
    },
    {
      start: () => console.log('Downloading models...'),
      progress: (progress) => console.log(`Download: ${Math.round(progress * 100)}%`),
      end: () => console.log('Download complete'),
    }
  );
})();

Automatic model downloading

Models are automatically downloaded from GitHub on first use. You’ll see download progress if you provide download callbacks:
await OpenComicAI.pipeline(
  './input.jpg',
  './output.jpg',
  [{ model: 'realcugan', scale: 4 }],
  undefined, // No progress callback
  {
    start: () => console.log('Downloading model files...'),
    progress: (p) => console.log(`${Math.round(p * 100)}% downloaded`),
    end: () => console.log('Models ready!')
  }
);
To download models ahead of time without processing an image, use the preload method.

Next steps

Basic usage

Learn about supported formats, parameters, and options

Model selection

Choose the right model for your use case

Pipeline processing

Chain multiple models for advanced workflows

Daemon mode

Optimize performance for batch processing

Build docs developers (and LLMs) love