Jump to content

Background Remover help


Jemboy
 Share

Recommended Posts

I have about 200 photo's that need the background removed.
After some Googleing I found this website: https://www.photoroom.com/background-remover/

This works really well, but it has one caveat. It only does one photo at the time.
Lickily they have an API (https://www.notion.so/API-Documentation-public-4eb3e45d9c814f92b6392b7fd0f1d51f) you can use to remove 1000/month backgrounds for free,

To use the API, you have to create an API key first: https://dashboard.photoroom.com/accounts/signup/
Specialy for this post I created an API key: 9a32a48575c3e952b890f4f678197981a978c75d

Using the API and API key, I wanted to create an AutoIt script, so I could do point to a folder and batch remove the background of my photos.

Seeing CURL is commandline, I thought it would be easy to use it with autoit. So I tested the line below, however I get: curl: (26) Failed to open/read local data from file/application

curl -H 'x-api-key:9a32a48575c3e952b890f4f678197981a978c75d' -F 'image_file=@d:/image.jpg' -f https://sdk.photoroom.com/v1/segment -o no-bg.png

I suspect that the culprit is the -F 'image_file=@d:/image.jpg' part.
Does any one know how to adjust this CURL line, so I can start buiding a script around it ? 😊

 

Link to comment
Share on other sites

1 hour ago, Jemboy said:

Does any one know how to adjust this CURL line, so I can start buiding a script around it ?

If you're executing that command line using PowerShell, then it will work just fine because it accepts strings wrapped in single quotes or double quotes.  If you are executing that command using CMD, then you will need to use double quotes instead of single quotes.

Link to comment
Share on other sites

@THeXMan Your the bomb!
Using double quotes (see below) solved the problem. I will now embark on the voyage to create a wrapper around this.😀

curl -H "x-api-key:9a32a48575c3e952b890f4f678197981a978c75d" -F "image_file=@d:/image.jpg" -f "https://sdk.photoroom.com/v1/segment -o no-bg.png"

 

Edited by Jemboy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...