Remove.bg compatibility

The Remove Background API offers a built-in compatibility with the API of Remove.bg.

This means that any code that calls the API of Remove.bg, like this one:

curl -H 'x-api-key: YOUR_REMOVE_BG_API_KEY' \
  -f https://api.remove.bg/v1.0/removebg \
  -F 'image_file=@/absolute/path/to/image.jpg' \
  -F 'crop=true' \
  -F 'bg_color=FFFFFF' \
  -F 'format=jpg' \
  -F 'size=hd' \
  -o result.jpg

Can easily be updated to instead call the Remove Background API, just by changing:

  1. The URL to https://sdk.photoroom.com/v1/segment

  2. The API Key to a Photoroom API Key

curl -H 'x-api-key: YOUR_PHOTOROOM_API_KEY' \
  -f https://sdk.photoroom.com/v1/segment \
  -F 'image_file=@/absolute/path/to/image.jpg' \
  -F 'crop=true' \
  -F 'bg_color=FFFFFF' \
  -F 'format=jpg' \
  -F 'size=hd' \
  -o result.jpg

As you can see, beside these two changes the rest of the code didn't need to be modified, because the name of the arguments and the format of the result both stay the same.

Last updated