transparent-background
v1.5.0
Published
transparent-background lets you easily remove backgrounds from images powered by InSPyReNet (ACCV 2022)
Downloads
71
Readme
Transparent Background (npm)
transparent-background
lets you easily remove backgrounds from images
Powered by InSPyReNet (ACCV 2022), thanks to @plemeri for creating transparent-background
- Python must be installed system-wide
- Works on Linux, macOS and Windows
- Python is already pre-installed on macOS
- If failing on Windows, you might have to install Python 3.8
pnpm install transparent-background
yarn add transparent-background
npm install transparent-background
Example
import * as fs from "fs/promises";
import { transparentBackground } from "transparent-background";
// const fs = require("fs/promises");
// const { transparentBackground } = require("transparent-background");
(async () => {
const input = await fs.readFile("test-input.png");
const output = await transparentBackground(input, "png", {
// uses a 1024x1024 model by default
// enabling fast uses a 384x384 model instead
fast: false,
});
await fs.writeFile("test-output.png", output);
})();