Node.js background removal that runs locally
Use the bgcut object API inside Node.js when background removal belongs in application code and you do not need a hosted HTTP service.
Open one remover and reuse it
bgcut creates a native local runtime. Keep the instance alive across related work instead of constructing a new model session for every image.
import { bgcut } from "bgcut";
const remover = await bgcut();
try {
const result = await remover.removeBackground("photo.jpg");
console.log(result.width, result.height, result.format);
} finally {
await remover.close();
}Process files, directories, and iterables
removeMany accepts files, directories, iterables, and async iterables. It processes inputs sequentially and yields each item as it completes.
Per-image failures are yielded with the source instead of forcing every later input to be discarded.
Choose the engine only when the caller cares
The default auto engine tries native WebGPU and can use CPU if runtime creation cannot use WebGPU. Use gpu or cpu when your environment requires one path.
An explicit GPU requirement is not silently changed to CPU.