Page 1 of 1

Using Remove.bg for image background removal (tutorial)

Posted: Wed Dec 09, 2020 8:31 pm
by magnussandstrom
We just setup a new Switch flow using the amazing service remove.bg for removing backgrounds on all kind of images. I though I would share this here if anyone else would like to know how to setup a similar flow (since the HTTP request setup imho is a bit tricky).

1. Register an account on https://remove.bg and buy some credit or an subscription.
2. On the remove.bg account choose API and generate a API key
3. Use the flow element HTTP Request and do the following parameters:
a. URL: https://api.remove.bg/v1.0/removebg
b. Request type: POST
c. Attached file: [Job.Path]
d. Use MIME encoding: YES
e. File varible: image_file
f. Authentication scheme: none
g. Parameters: size=auto (here you can choose your wanted parameters from remove.bg API documentation)
h. Headers: X-API-Key: YOUR-API-KEY-HERE
i. Response: Inject as new job
j. Filename: [Job.NameProper].png
k. Input job: discard
4. Done

Enjoy!

Re: Using Remove.bg for image background removal

Posted: Mon Sep 13, 2021 10:26 am
by LarsA@normik.dk
Thank you very much, Magnus.
It was very helpful.
Have you found a way to handle zip output files?
Zip files contain 2 files: color.jpg and alpha.png which must be combined into one photoshop file

Re: Using Remove.bg for image background removal

Posted: Mon Sep 13, 2021 11:06 am
by magnussandstrom
Hi Lars, happy that it works for you!

I have not yet tried to utilize the ZIP option from Background.bg. But it should be possible to merge the two files with ImageMagick within Switch.

In our flow we shrink files larger then 25 mp to 25 mp with ImageMagick before routing to Remove.bg.

Re: Using Remove.bg for image background removal (tutorial)

Posted: Tue Sep 14, 2021 3:03 pm
by LarsA@normik.dk
Thanks, I'll try with ImageMagick :)

Re: Using Remove.bg for image background removal (tutorial)

Posted: Mon Nov 06, 2023 2:05 pm
by nhan
Thank you very much, Magnus.
It was very helpful.but can you help me configure for web pixian.ai, this is my propertive

a. URL: https://api.pixian.ai/api/v2/remove-background
b. Request type: POST
c. Attached file: [Job.Path]
d. Use MIME encoding: YES
e. File varible: image_file
f. Authentication scheme: none
g. Parameters: size=auto (here you can choose your wanted parameters from remove.bg API documentation)
h. Headers: X-API-Key: my API secrect
i. Response: Inject as new job
j. Filename: [Job.NameProper].png
k. Input job: discard
4. Done

when I register at pixian, my API key includes API id and APi serect, I use API serect for the header and get the error " Request finish status: Failed; status code: 400; status description: Bad Request; last error: HTTP protocol error. 400 Bad Request. " from Swich