DEV Community

Cover image for How I Decompose Any Image Into Recomposable Layers on Melius
Igor Gridel
Igor Gridel

Posted on • Originally published at igorgridel.com

How I Decompose Any Image Into Recomposable Layers on Melius

When you iterate on an AI-generated image by re-prompting, you destroy it.

You ask the model to "move the figure left and remove the truck," and the entire scene shifts: different lighting, different building geometry, different snow texture. Anything that wasn't pinned by the original seed gets re-rolled. You lose the bake you liked.

Photographers don't work this way. Concept artists don't work this way. They hold the layers and move them.

I wanted that. So I built it.

The pipeline in one paragraph

One Melius canvas. An analyzer LLM reads any input image and outputs a JSON blueprint of seven candidate layers: background, middle ground, foreground, and up to four subjects. Seven parallel extractor LLMs pull each layer's isolation prompt out of the JSON. Seven NanoBanana Pro nodes regenerate each layer on chroma green, preserving original position, scale, and lighting. Background-removal nodes strip the green. A final NanoBanana Pro pass takes all seven transparent layers and renders a unified, lighting-coherent composition. You can move, scale, drop, or swap any layer before the final pass.

Why this matters

Single-pass generation treats an image as one indivisible thing. Inpainting and reference conditioning are partial fixes, but the model still guesses at occluded regions. Move the truck and the snow underneath has to be invented from nothing.

The fix is to never bake the image to begin with. Treat the original as a brief, decompose it into stacked elements, and only recompose at the end, after the elements are arranged the way you want them.

That requires a real pipeline. A node graph is the right shape for a real pipeline. Melius gave me the canvas that can hold one.

What's in the full breakdown

I wrote the full workflow on Scopeful Pro: every node, both system prompts (the analyzer and the universal extractor template), the mistakes I made first, and the things I'd change in v2.

If you want the prompts, the node-by-node walkthrough, and the canvas itself, here is the full version:

How I Decompose Any Image Into Recomposable Layers on Melius

The video demo (14 seconds, the layer explode shot) is on my X feed (@igorgridel).

Top comments (0)