2.0.5 • Published 12 months ago

sharp-remove-bg-ai v2.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Sharp remove bg AI

⚠️ This project is a fork from: https://www.npmjs.com/package/rembg-node Original author: https://github.com/makidoll

npm.io

Sharp Remove bg AI lets you easily remove backgrounds from images using the U2-Net AI model

This is a loose port of the original Rembg for Python, big thanks to @danielgatis

It uses sharp for input and output so you can easily integrate it

The masking algorithm isn't fully complete yet, but the results are pretty good already!

yarn add sharp rembg-node

npm install sharp rembg-node

Example

import { Rembg } from "rembg-node";
import sharp from "sharp";

// const { Rembg } = require("rembg-node");
// const sharp = require("sharp");

(async () => {
	const input = sharp("test-input.jpg");

	// optional arguments
	const rembg = new Rembg({
		logging: true,
	});

	const output = await rembg.remove(input);

	await output.webp().toFile("test-output.webp");

	// optionally you can use .trim() too!
	await output.trim().webp().toFile("test-output-trimmed.webp");
})();
2.0.5

12 months ago

2.0.3

12 months ago

2.0.2

12 months ago