Retrobatch & external cloud services

Hi, is there an easy way to let Retrobatch interact with cloud image services like https://www.remove.bg? I Would like t to remove the Background for every new photo arriving in a folder (via Cascable)

Thanks,

Andreas

Nothing is built in but if you can write a shell script to call out to your service, then you could the Shell Script node to call out to it.

It looks like there is an API to use it: https://www.remove.bg/api

I took a closer look their API, and for Retrobatch to use it with the shell script node, it’ll need a little bit of tweaking, which I’ve done in the latest build: http://flyingmeat.com/download/latest/#retrobatch

Here’s what the release notes say:

  • Shell Script node improvements: If the output from your script contains a line that starts with outputImagePath: followed by a path to a valid image, that image will be used for the rest of the workflow.
  • More Shell Script improvements: You can return image data from a shell script if the output of your script is ‘imageData:’ followed by a newline, and then valid image data to read in.

So, using remove.bg’s api, you would write a script that looks like this:

#!/bin/bash
echo "imageData:"
curl -H 'X-API-Key: <YOUR_API_KEY_HERE>' \
     -F "image_file=@$1" \
     --silent \
     -f https://api.remove.bg/v1.0/removebg

The bits that say <YOUR_API_KEY_HERE> will need to be replaced with an API key from remove.bg, which you can request from their site: https://www.remove.bg/api

Give it a try, and if you need more help- let us know! Shell scripts can be a little tricky sometimes, and I can walk through that a bit more if needed.

1 Like