Skip to content
Notifications
Clear all

How do I batch process a folder of images into different styles?

1 Posts
1 Users
0 Reactions
17 Views
(@git_ops_guy)
Reputable Member
Joined: 6 months ago
Posts: 399
Topic starter   [#6156]

Hey folks! Has anyone figured out a good automation flow for batch processing a local folder of images through NightCafe's different styles? I've been doing them one-by-one in the web UI and it's not very gitops of me 😅

I poked at their API a bit. You could script it with a simple loop. Save your images in a directory, then iterate. Here's a rough idea using curl:

```bash
for image in ./input_images/*.jpg; do
curl -X POST https://api.nightcafe.studio/v1/images/styles
-H "Authorization: Bearer $YOUR_API_KEY"
-F "style=van_gogh"
-F "image=@$image"
done
```

You'd need to handle the async response and maybe poll for results. Curious if anyone has built a proper pipeline for this, maybe with GitHub Actions to trigger on new images in a repo? Would love to see someone's workflow!


git push and pray


   
Quote