By the end of this guide you will haveDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ollm/opencomic-ai-models/llms.txt
Use this file to discover all available pages before exploring further.
opencomic-ai-models installed, the absolute path to the bundled models/ directory resolved in your code, and a working Node.js snippet that passes that path to an upscaler binary to enhance a comic page image. The only public API you need is OpenComicAIModels.path — a single string property that does all the heavy lifting of locating the model files on disk.
npm will fetch the repository, run the Rollup build step automatically via the
prepare lifecycle hook, and place the compiled output and model weights under node_modules/opencomic-ai-models/. ESM (TypeScript / modern JS)
"type": "module" in its package.json, or in a .mjs / .mts file. CJS (CommonJS)
require(), such as older Node.js scripts or projects without "type": "module".Both forms load the same underlying data and expose the identical
path property — pick whichever matches your project’s module system.import OpenComicAIModels from 'opencomic-ai-models';
const modelsPath: string = OpenComicAIModels.path;
console.log(modelsPath);
// → /home/user/my-project/node_modules/opencomic-ai-models/models
The path is resolved at module-load time using
path.join relative to the package’s own __dirname (or import.meta.dirname in ESM), so it is always accurate regardless of where your project lives on disk.With
modelsPath in hand you can invoke any compatible upscaler binary. The example below uses Node.js’s built-in child_process.execFile to call the upscayl-bin executable with the realesrgan-x4plus-anime model — a popular x4 upscale model for anime-style comic art:import { execFile } from 'node:child_process';
import path from 'node:path';
import OpenComicAIModels from 'opencomic-ai-models';
const modelsPath: string = OpenComicAIModels.path;
// Paths for input and output images
const inputImage = path.resolve('input.png');
const outputImage = path.resolve('output.png');
// Model ID to use — must correspond to a subdirectory inside modelsPath
const modelId = 'realesrgan-x4plus-anime';
// Path to your upscayl-bin executable (adjust to your system)
const upscaylBin = '/usr/local/bin/upscayl-bin';
execFile(
upscaylBin,
[
'-i', inputImage,
'-o', outputImage,
'-m', modelsPath, // <-- pass the resolved models directory
'-n', modelId, // <-- specify the model by ID
'-s', '4', // scale factor
'-f', 'png', // output format
],
(error, stdout, stderr) => {
if (error) {
console.error('Upscaling failed:', error.message);
console.error(stderr);
process.exit(1);
}
console.log('Upscaling complete →', outputImage);
console.log(stdout);
}
);
The key arguments are
-m modelsPath (the directory containing all model subdirectories) and -n modelId (the specific model to use). The upscaler binary locates the model files inside modelsPath/realesrgan-x4plus-anime/ at runtime.Not sure which model ID to use? The Upscale Models, Artifact Removal, and Descreen pages list every bundled model with its ID, display name, compatible upscaler backend, and original source. For general anime and manga upscaling
realesrgan-x4plus-anime is a solid default; for removing JPEG compression artifacts before upscaling, combine it with a pass using opencomic-ai-artifact-removal.Complete Example
Here is a self-contained TypeScript file that brings together all four steps above:UPSCAYL_BIN environment variable to the full path of your upscayl-bin executable if it is not on your PATH.