Coder Social home page Coder Social logo

rebackground's Introduction

rebackground

Replace the background of (almost) any image.

If anyone wants to experiment and include a better image editing model that would be really cool; DALL-E, as good as it is, isn't fantastic with real images and creates some fairly trippy results:

rebackground -i 'craig.jpg' -o 'craig_rainforest.png' -p 'Broadcasting from a rainforest'

Craig Craig Rainforest

Setup

  1. Clone the repo

    git clone [email protected]:king-millez/rebackground.git
    cd rebackground
  2. Set the remove.bg and OpenAI environment variables.

    • To learn how to set environment variables on your OS, follow this guide. You may find better Windows-specific info here.
    • Set REMOVEBG_API_KEY to the key obtained from following this guide (click the big "Get API Key" button).
    • Set OPENAI_API_KEY to the key obtained from this page. You need an OpenAI account, etc etc.
    • Note: you may need to log out and log back in for environment variable changes (especially on Windows) to work.
  3. You can build the application or run it with dotnet. This app should work on Windows, MacOS, and Linux. If it doesn't, let me know and I'll fix it (open a GitHub issue, do not email me).

Usage

If you don't want to compile, just replace rebackground with dotnet run --

You'll need to crop your input images to have a 1:1 ratio, e.g 512x512, 1080x1080, etc.

rebackground -i <input image> -o <output image (will be a PNG)> -p <DALL-E edit prompt>

rebackground's People

Contributors

king-millez avatar

Watchers

 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.