Jemboy Posted February 24, 2022 Share Posted February 24, 2022 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 More sharing options...
TheXman Posted February 24, 2022 Share Posted February 24, 2022 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. Jemboy 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Jemboy Posted February 24, 2022 Author Share Posted February 24, 2022 (edited) @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 February 24, 2022 by Jemboy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now