Giter Site home page Giter Site logo

rembg-server's Introduction

REMBG SERVER

Rembg Server is a Node.js server that allows you to process images and remove their backgrounds using the Rembg library.

Getting Started

Follow these instructions to set up and run the Rembg Server on your local machine.

Prerequisites

  • Node.js (v12 or higher)
  • npm (Node Package Manager)

Installation

  1. Clone the repository

  2. Install the required npm packages:

cd rembg-server
npm install

Usage

To start the Rembg Server, run the following command:

npm start

The server will start running on the specified port (default is 3005). http://localhost:3005/

Endpoints

The Rembg Server provides the following endpoint:

  • POST /process: Send a POST request to this endpoint with a JSON body containing the imageUrl of the image you want to process. The server will download the image, process it using Rembg to remove the background, and save the processed image locally. The response will contain the URL of the processed image.

Example Usage

curl -X POST http://localhost:3005/process \
  -H "Content-Type: application/json" \
  -d '{"imageUrl": "https://example.com/image.jpg"}'

Response

The server will respond with a JSON object containing the URL of the processed image:

{
  "imageUrl": "http://localhost:3000/images/sku12345.png"
}

Image Storage

The processed images are saved in the processed_images folder at the root of the project.

CORS Configuration

The server is configured to allow cross-origin requests. By default, it allows requests from all origins. If you want to restrict access to specific origins, you can modify the CORS configuration in the index.js file.

rembg-server's People

Stargazers

Adhish avatar Shealan Forshaw avatar Ugur Bulut avatar VeraZab avatar

Watchers

Michael Gutierrez avatar

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.