Download latest stable release (Windows, Mac, Linux)
removebg [options] <file>...
To process images you'll need your remove.bg API key.
To use the API key for all requests you can export the following environment
variable in your shell profile (e.g. ~/.bashrc
/ ~/.zshrc
):
export REMOVE_BG_API_KEY=xyz
Alternatively you can specify the API key per command:
removebg --api-key xyz images/image1.jpg
Please note that the CLI tool is currently limited to images up to 10 megapixels (larger images are resized). You can get higher-resolution images of up to 25 megapixels via --format zip
and then converting the ZIP file to the format of your choice (see here). In the future we plan to extend the CLI tool to compose the final picture automatically.
If you want to remove the background from all the PNG and JPG images in a directory, and save the transparent images in the same directory:
removebg images/*.{png,jpg}
Given the following input:
images/
├── dog.jpg
└── cat.png
The result would be:
images/
├── dog.jpg
├── cat.png
├── dog-removebg.png
└── cat-removebg.png
If you want to remove the background from all the PNG and JPG images in a directory, and save the transparent images in a different directory:
mkdir processed
removebg --output-directory processed originals/*.{png,jpg}
Given the following input:
originals/
├── dog.jpg
└── cat.png
The result would be:
originals/
├── dog.jpg
└── cat.png
processed/
├── dog.png
└── cat.png
-
--api-key
orREMOVE_BG_API_KEY
environment variable (required). -
--output-directory
(optional) - The output directory for processed images. -
--reprocess-existing
- Images which have already been processed are skipped by default to save credits. Specify this flag to force reprocessing. -
--confirm-batch-over
(default50
) - Prompt for confirmation before processing batches over this size. Specify-1
to disable this safeguard.
Please see the API documentation for further details.
--size
(defaultauto
)--type
--channels
--bg-color
--format
(default:png
)
Prerequisites:
go 1.12
dep
Getting started:
git clone git@github.com:remove-bg/go.git $GOPATH/github.com/remove-bg/go
cd $GOPATH/github.com/remove-bg/go
bin/setup
bin/test
To build & try out locally:
go build -o removebg main.go
./removebg --help