How to automate routine image and video work with an AI agent
How to set up an agent that handles image edits, background removal, upscaling, and kiosk video assets from a Slack message - including the specific models we use for each job
A lot of creative work at any company is not really creative in the true sense. It is things like resizing the image, swap the background of a product, upscaling a low res image, showing multiple products together etc. This is mostly boring labor work that no designer really likes to do.
We have a lot of such work at XPR. Since we manage the creatives shown on the Kiosks at all our locations, we have to tune the products and assets in the right size, language, and brand theme. This post covers how to hand that work to an AI agent and which models we found useful for each job.
Put a language model in front of the image models
The setup involves putting an agent (a language model) in front of a set of image tools. Someone drops an image in a Slack channel, says what they want, and the agent picks the right tool, runs it, and posts the result back in the same thread. If the result is off, you say so in the thread and it goes again. No queue, no waiting for a designer's slot.
Now, the obvious question - the new generation of image models like GPT Image and Google's Nano Banana understand language pretty well themselves. You can hand them an image and an instruction and they will do the edit. So why the agent in front?
Because the language-capable image models cover only part of the work, and an agent is still needed to stitch the whole job together -
- They do the edits, not the surrounding work. Nano Banana can replace the burger in a photo with a chicken burger. It cannot resize the result to your exact kiosk dimensions, convert it to WebP, upscale a low-res original first, or produce a clean transparent background (more on that below). Those need other tools, and the agent knows which one and in which order.
- The agent carries your context. It knows the kiosk screen sizes, where the brand assets live, and what the theme spec looks like. The person asking types one line; the agent fills in the rest.
- The agent knows when not to use AI at all. A plain resize or format conversion is a free, instant PIL call, not a paid model call. A person working with an image model directly tends to ask the model for everything.
- A tool can wrap a model with fixes the model needs. Our edit tool does pre- and post-processing around Nano Banana that makes it reliable for our assets. That wrapper is impossible if people just use a chat app with the image model.
How it works
The agent has a small toolbox rather than one tool per verb -
- An AI edit tool (Nano Banana 2). This is the workhorse. Complex edits happen in one call: swap a product, change the scene, combine up to two reference images ("put this dish on that table"). No chaining needed for most requests.
- An AI generation tool (GPT Image 1.5 by default; Nano Banana 2 when someone asks for it by name). For new images - a hero image for a blog post, a concept image for a campaign.
- Specialist models for the jobs the big models cannot do: background removal (rembg, or BiRefNet for tricky edges) and 4x upscaling (AuraSR).
- Free deterministic tools: resize, convert, center, overlay, add text - plain Python. And ffmpeg for video.
Some simple requests can be done with a single tool call. A bigger one may require chaining a few: upscale the low-res product shot, edit it into the scene, resize for the kiosk, overlay the logo. The agent decides the whole chain - the user only needs to define the final outcome they'd like.
The transparency problem
Transparency is a big problem with today's image models (July 2026).
Kiosk and menu work runs on cutouts - product photos with the background removed so they can sit on any theme. And the multimodal image models, including GPT Image and Nano Banana, cannot reliably produce a transparent-background output. They also behave badly when you hand them a transparent input.
So transparency is handled outside the AI models, in the tool wrapper, in both directions -
- Output side: when a result needs a transparent background, a dedicated background-removal model (rembg or BiRefNet) runs on the model's output. Never trust the generation model to do it.
- Input side: when someone sends a transparent image for editing, the tool first composites it onto a solid bright-magenta background - a chroma key that never occurs in food photography - then sends it to Nano Banana. The model now has clean visual context and edits properly. Afterwards the tool removes the magenta background again, and the result is a cutout like the original.
One subtle bug worth pointing out. To determine if an image is transparent, "the file has an alpha channel" is not the same as "the image is transparent." PNG encoders routinely save fully opaque images as RGBA, and a PNG-to-WebP round trip leaves a few stray transparent edge pixels. If the tool treats those as real cutouts, it magenta-flattens and background-removes images that never needed it, and quietly ruins them. Only treat an image as transparent when a meaningful fraction of pixels (we use 1%) actually are.
Which image models to use
We route the image model calls through fal.ai, which hosts all of these behind one API and one key. That makes trying and swapping models a small change - we moved our generation default from Flux to GPT Image 1.5 without anyone using the agent noticing.
| Job | What we use | Notes |
|---|---|---|
| Image editing | Nano Banana 2 | All AI edits go through it: product swaps, scene changes, multi-image composition. Takes an instruction plus one or two reference images. |
| Image generation | GPT Image 1.5 default, Nano Banana 2 on request | Both understand a written brief well. flux/schnell is set as a fallback when both fail - fast and cheap, quality just acceptable. |
| Background removal | rembg, with BiRefNet v2 for hard cases | rembg is cheap and fine for product shots. BiRefNet handles complex edges better. |
| Upscaling | AuraSR (4x) | Used when a source image is smaller than the target, before the edit. |
| Resize, convert, overlay, text | PIL (plain Python) | Free, instant, deterministic. No reason to involve an AI model. |
| Video and animated WebP | ffmpeg | Kiosk home-screen videos are stitched from the brand's still images with zoom and crossfade effects, then converted to animated WebP. Procedural, not generative, and free. Generative video didn't work reliably for us here - brand assets need to look exactly like the brand. |
The setup
The agent never talks to a model vendor directly. It calls a named tool, and the model choice, the fallbacks, and the transparency wrapper all live inside the tool. That allows us to change the generation default without retraining anyone.
Cost stays bounded because one tool call is one image. There is no loop where the model renders fifty variations chasing its own taste. If a person wants another version, they ask, and that is one more call. (How we track that spend per person and per model is a post of its own, coming later in this series.)
One more note. Since we built this, Anthropic launched Claude tag, which puts a Claude agent directly into Slack. If you use it, everything above still applies - Claude tag gives you the language model in the channel, but the image tools, the model choices, and the transparency wrapper are still yours to build and connect. I compare the two approaches properly in a separate post.