cd /news/generative-ai/chroma-keying-an-image-model-to-make… · home › topics › generative-ai › article
[ARTICLE · art-174010] src=sandkassa.app ↗ pub= topic=generative-ai verified=true sentiment=↑ positive

Chroma keying an image model to make stickers for my kids

A developer built a sticker app for his daughters that uses chroma keying rather than pure AI to cut clothing drawn by an image model, after background subtraction and segmentation approaches failed. The developer turned the doll signal green (#00E040) with a small Python script so the model could dress a mannequin, then keyed out the green, adding a thin white edge; he said his favorite image model as of November 2026 is one whose name is cut off in the source. The account documents the failed approaches — pixel subtraction left pink face and hand outlines and red holes in trousers and boots, and standalone clothing generations did not fit the doll — as reusable image-processing lessons for anyone automating AI image output.

key takeaway

Render the subject on a signal-green (#00E040) mannequin and chroma-key it out instead of subtracting the original image, because an image model redraws faces, hands and lines and no subtraction threshold cleanly separates clothing from skin.

by read13 min views6 publishedNov 22, 2026
Chroma keying an image model to make stickers for my kids
Image: source

Chroma keying, flood fills, a bit of trial and error and a thin white edge. How I cut out clothes an image model has drawn, for a sticker app I made for my daughters.

Give an image model a drawing and ask it to dress the figure, and you don’t get the same drawing back with clothes on. You get a new drawing. The face is slightly different, the hands are redrawn, and the lines have moved. That makes it surprisingly hard to cut out just the clothes.

I’ve been nerding out quite a bit with image models and image processing this year, and it ended up as a sticker app for my daughters. I wanted to automate as much as possible around the AI, both so I could test it programmatically and so it would be easy to make new pages when the girls got bored of the ones we had and came up with new ideas.

It ended with a green doll, chroma keying like in film and TV, and a few Python scripts that do the rest. Most of it isn’t AI at all, just image processing. I’ve included the things that didn’t work too. The demos run straight in your browser, on the same pictures the stickers in the app were cut from.

First idea: subtract the doll from the picture #

The first idea was the simplest one I could think of. I gave the image model the doll and asked it to draw the clothes on her. Then I subtracted the undressed doll from the dressed picture, pixel by pixel. Whatever was different had to be the clothes. It’s plain background subtraction, a technique much older than image models, with the doll as the background.

But the model draws a whole new picture, including the parts you didn’t ask it to touch. Try it:

– of face and hands kept**–** of trousers and boots lost

Try to find a value where the face is gone and the trousers are whole. I couldn’t find a threshold that works, anyway. Set it low and you get the outline of the face and the hands, in pink, because the model drew the lines slightly differently. Set it high and the trousers and boots get holes, in red, wherever the colour happens to match what was underneath. Switch on “Show what the model redrew” and you can see that even the eyes have been redrawn.

In practice the clothes came with bits of neck and hands, and the shoes got holes where the foot showed through. I rubbed out skin by hand. Whatever I missed, the girls found.

Two more dead ends #

I also tried asking the model to draw the piece of clothing on its own, on a transparent background. The clothes looked fine, but they didn’t fit the doll. The model had no body to draw on, so the shape and size came out a bit different every time. And the model’s transparency isn’t entirely to be trusted, as you’ll see further down.

Then I looked at segmentation, tools like rembg that separate the foreground from the background, and tested it a little. They work well on a thing standing on its own, like an umbrella or a frog. But here the doll is foreground too, and I wanted to separate the jacket from the arm inside it. The trousers under the jacket aren’t in the picture at all, so no model can cut them out. And segmentation is another model, with its own guesses. I’d rather have something I could predict.

Green screen: make the doll green #

Then I thought of how films do it. The actor stands in front of a green wall, and everything green gets replaced afterwards. It’s called chroma keying, and film and TV have used it for decades. No need to invent anything new, so I made the doll green.

  1. The doll
  2. Same doll, signal green
  3. The model dresses it

A small script turns the doll signal green, #00E040. Only faint, darker lines are left, where she has fingers, ears and a face, so the model can see where things are. The model gets the mannequin and a normal picture of the doll, so it knows which style to draw in, and then it dresses the mannequin. I’ve tried quite a few image models with this. My favourite right now, in November 2026, is probably ChatGPT, and that’s the one drawing here. But the technique works well with plenty of other models too.

Now there’s nothing to compare. Green is body, the background is transparent, and whatever is left is clothes. A pixel is body when green is more than 45 above both red and blue. The demo below uses the same rule, with a soft edge. Watch the hands and the wings: they’re green, so they disappear, however the model happened to draw them.

This is what the model drew. Tap 2 to take away the green.

– pixels counted as body

Green clothes don’t work, though, because they look like body. A robot suit got a green button, and the button became a hole. It got a yellow one instead. So clothes with a lot of green in them are drawn on a magenta mannequin. And on the page where the doll has both a green dinosaur suit and a purple dragon suit, the mannequin is cyan.

  1. Magenta: green Christmas pyjamas
  2. Cyan: dinosaur suit

The green screen didn’t make a page any quicker to produce. It takes about as long as before. But the stickers came out whole, and I don’t have to rub out hands any more.

One outfit, drawn three times #

The next problem was clothes on top of each other. The jacket covers the top of the trousers, and the boots cover the bottom. Cut the trousers out of that picture and you get trousers with no waistband and a ragged hem.

  1. Cut from the full outfit
  2. Drawn whole

The fix is to ask for the same outfit three times in the same conversation. First the whole outfit, so the style matches across all the pieces. Then the same picture again, with only the jacket, helmet and boots. Finally only the trousers, drawn whole, including the parts that were under the jacket and inside the boots.

  1. The whole outfit
  2. Only jacket, helmet and boots
  3. Only the trousers, whole

Now every piece of clothing is a whole sticker, and the child can dress the doll in any order. But the order matters: whatever goes on last ends up on top. Put the jacket on before the trousers and the trousers end up over the jacket. That’s how a real sticker book works too, and the girls got it quickly. It’s part of the fun. Dress the doll in the wrong order and you’ll see:

Stickers

On the doll, bottom to top: nothing yet

Drag the clothes onto the doll, wherever you like. Whatever you add last ends up on top. Drag a piece off the page to put it back.

Drag the clothes onto the doll.

There’s no snapping in the app either. The sticker stays where the child lets go of it.

What the model still gets wrong #

Three pictures per outfit is three chances to get it wrong. In October around 95 out of 100 pictures could be used as they were, I reckon. But the model isn’t stable. In November it painted a lot more chequerboards than before.

The chequerboard is the strangest one. Sometimes the model doesn’t make a transparent background at all, but paints a grey and white chequerboard, the way image editors show transparency. Which is pretty funny, really. The models are trained on millions of pictures from the internet, and apparently a lot of them claim to be transparent but are really screenshots from some editor with a chequerboard behind. So the model has learned that this is what transparent looks like. You get what you train. I added a step that removes light grey checks connected to the edge of the image. Then a white bunad shirt disappeared, because it was taken for checks. Now the checks are only removed when they actually reach the edge, and not when the picture has real transparency. White clothes on painted checks are still tricky.

  1. Painted "transparency"
  2. White trousers on painted checks

And clothes that don’t cover all of the underwear, like a swimsuit, let the doll’s vest or shorts show through. I haven’t fully solved that.

Trial and error puts the picture back in place #

The model also sometimes draws the body a little bigger or slightly shifted, and now and then the picture comes back in a different size from the one I sent. So the script lays the picture over the mannequin and tries things out: a bit bigger, a bit smaller, a bit to the side, until the green fits best. It’s plain trial and error, no machine learning involved, coarse first and then fine around the best match. On the firefighter page, under half a per cent of the green ended up outside the mannequin.

Once the picture is in place, the script also measures where each piece belongs on the doll. That’s used for the book cover, the preview and the tests, never to pull the sticker into place.

The white edge #

Nothing ever comes out quite perfect when you mask images. There are always a few pixels in the transition that are a bit of both, a bit clothing and a bit green. Here and there a greenish tinge is left behind.

So the script first peels off the outermost pixels with a green tinge, where the clothes meet the body. Small holes are found by flood-filling from the edge of the image, and small jaggies are smoothed away. It all comes ready-made in Pillow and SciPy. There’s no despill here, no recolouring of green edge pixels back to the right colour. They’re simply removed, and the edge is softened by one pixel. That works because the drawings are flat, with clear outlines.

But when you’re making stickers, you have a saving grace: the thin white edge. It sits underneath the sticker and shows 5.5 page units all the way round, on a page that is 700 units wide. And you could go further and pull it a little into the picture, so it covers the outermost pixels and takes the noise with it.

Try it on the tiara from the ballerina page, which is drawn on top of the green hair. Pull the edge into the picture and watch the green tinge go, and compare with the actual-size view. The demo fills holes with a closing where the script uses a flood fill, but the result is roughly the same. I don’t do all of this in the app. The peeling, the smoothing and the edge underneath are there, but the edge isn’t pulled into the picture. On an iPad screen with around four million pixels, a greenish pixel here and there is too small to see.

Trust but verify #

The last script came about because I kept stumbling on mistakes. At the start of November I found a sticker with two things in one, some stickers that were too small to get a proper grip on, and a hat that was see-through. You don’t spot those things looking at one sticker at a time in a folder.

So now every sticker is measured the way the app gets it, with the white edge on, and each one is checked for four things:

  • Pieces: more than one white island in the same sticker, meaning two things have become one.
  • Holes: transparent holes inside the sticker, where the doll would show through.
  • Pale: how much of the drawing is semi-transparent, so it looks pale and grey on the doll.
  • Small: under 60 page units on the longest side, or under 30 on the shortest.

Everything ends up on sheets seven stickers wide, two pages per sheet. Anything I should look at more closely gets a red background and a red note underneath.

A flag doesn’t mean something is wrong, just that I should look at it. Last time I ran them all, about 14 percent of the stickers were flagged, most of them for being small or having holes. I go through them and fix whatever is actually wrong.

Whether the jacket looks right on the doll is the five-year-old’s job. I had planned to build a tool for that as well, but it was never needed. If something doesn’t fit, she tells me and asks me to fix it.

Only one step is AI #

An image model never does quite the same thing twice. You saw it on the face in the first demo. That’s fine for coming up with a fire jacket, but not for cutting out thousands of stickers the same way.

So in the pipeline below, only one step is AI. The dolls and backgrounds are drawn by a model too, but that’s another story. Everything after the picture is drawn is done by ordinary scripts here on my Mac, with no online services. What runs is plain Python, mostly Pillow, NumPy and SciPy. Of course I use AI to help me with the code too, but that’s a very different thing from letting AI make the pictures themselves. Two different ways of using AI.

The girls ask for something. They have plenty of opinions about which stickers are missing. A lot of what they come up with becomes pages.

The ballerina Layer 1: tiara, tutu leotard, ballet shoesLayer 2: tights

Deciding on the outfit. We decide the pages and outfits at home. The plan splits every outfit into layers.

Green mannequin. The doll turns signal green, with faint lines left. The background becomes transparent.

The image model dresses it. The whole outfit first, then layer by layer, in the same conversation with the model.

Fit to the mannequin. Finds the best scale and position, removes the green and painted checks, fills holes and numbers the pieces. About a second per picture.

White edge. The same edge on every sticker, with a slight bevel. Saved as WebP at the size the app uses.

Contact sheets. Every sticker is measured and laid out on sheets, and anything I should look at more closely turns red. A little over three minutes.

I check the flags. I go through what has been flagged and fix whatever is actually wrong.

Tested on the doll. The five-year-old puts the stickers on and says so when something doesn’t fit.

Tap a step to see what happens there.

I think that’s the trick with AI. The image model isn’t deterministic, but the code is, whoever helped write it. The scripts are fast and cheap, I can test them, and if I run them again tomorrow, I get the same answer.

If you want to see how it turned out, you can read more about Klistre and try it yourself. The first 20 pages are free, with nearly 500 stickers, so there’s plenty to play with, whether you’re curious about the result yourself or have kids at home who can test it for you.

── more in #generative-ai 4 stories · sorted by recency
── more on @rembg 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/chroma-keying-an-ima…] indexed:0 read:13min 2026-11-22 · —