Code Monkey home page Code Monkey logo

rembg-node's Introduction

Rembg Node

โš ๏ธ This project is unmaintained. I wouldn't recommend using it either.
Some of the algorithms are missing and results are often not great.
I instead recommend you check out my other package:
https://github.com/makidoll/transparent-background-npm


Rembg 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");
})();

rembg-node's People

Contributors

makidoll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rembg-node's Issues

Image completely transparent

Hi !

For some reason, the output image is completely transparent.

I have tried with different images but the result is always the same.

Any idea where this could be coming from ?

Thanks :)

Failed to download gdrive link

/home/Desktop/my_project/back-end/node_modules/rembg-node/dist/gdown.js:5
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
^
Error: Failed to download gdrive link
at /home/Desktop/my_project/back-end/node_modules/rembg-node/dist/gdown.js:84:23
at Generator.next ()
at fulfilled (/home/Desktop/my_project/back-end/node_modules/rembg-node/dist/gdown.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.