Using Remove.bg for image background removal (tutorial)

Post Reply
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Using Remove.bg for image background removal (tutorial)

Post 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!
Last edited by magnussandstrom on Mon Sep 13, 2021 12:38 pm, edited 1 time in total.
LarsA@normik.dk
Newbie
Posts: 9
Joined: Mon Mar 25, 2019 11:15 am

Re: Using Remove.bg for image background removal

Post 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
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Using Remove.bg for image background removal

Post 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.
LarsA@normik.dk
Newbie
Posts: 9
Joined: Mon Mar 25, 2019 11:15 am

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

Post by LarsA@normik.dk »

Thanks, I'll try with ImageMagick :)
nhan
Newbie
Posts: 2
Joined: Thu Nov 11, 2021 3:12 pm

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

Post 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
Post Reply