ComfyUI Node

Scene Generator

It's a scene renderer, not a generator — and that's the whole trick

By Ron-Digital·Created 2 years ago·Updated 2 years ago· 3
Scene Generator
    • STRING
    • STRING
    json_img

    The name is a lie in the best way. Scene Generator doesn't generate anything - no diffusion, no checkpoint, no VRAM. Feed it a chunk of JSON that describes where products and props sit on a canvas, and it downloads each layer image over HTTP, flips, scales and rotates them, and pastes them together in z-order. Two base64 PNGs come out the other end: one with only the products on a transparent background, one with the full scene (products plus props) on white. It's a compositing bridge, not an AI tool.

    That makes it a niche pull, but a real one. If you're automating e-commerce product previews - the kind of thing where a backend or dashboard lays out a shot and you need a rendered preview to show a client - this node is a straight line from "layout JSON" to "picture." If you were hoping for a prompt-to-scene magic button, keep scrolling.

    What it actually does (read this before you run it)

    The single input, json_img, is one multiline string holding a JSON document with this shape:

    {
      "json_img": {
        "stage": { "width": 1024, "height": 1024 },
        "json": [
          { "config": {
              "x": 100, "y": 50, "z": 0, "rotation": 0,
              "flip": "[1,1]", "scale": { "x": 1.0, "y": 1.0 },
              "src": "https://example.com/prop.png",
              "p_type": "prop"
          } }
        ]
      }
    }
    

    The stage sets the canvas size. Each entry in json is a layer: x/y position, z for stacking order, rotation, flip (a JSON list where -1 mirrors), scale, and a src URL the node fetches at runtime. The one field that decides everything is p_type - "product" layers land on both outputs, "prop" layers (fire, plants, whatever dressing) land only on the main scene. The products-only image carries a mask that props get subtracted from, so you get a clean product cutout even when a prop overlaps it.

    The two STRING outputs are base64-encoded PNGs, and order matters: first is products-only, second is the full scene. Here's the trap - they're strings, not IMAGEs. ComfyUI's image nodes won't accept them, so to actually look at the result you need a base64-to-image decoder node in the graph, or you pipe the string out and decode it elsewhere. Plan for that before you wire anything up.

    Installing it (and dodging the one real landmine)

    ComfyUI Manager is the easy route - search "SceneGenerator" or the pack title and install. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Ron-Digital/ComfyUI-SceneGenerator
    # restart ComfyUI
    

    No model downloads. It depends on Pillow, requests, and numpy - all things any working ComfyUI already has. Don't run pip install -r requirements.txt from the repo. That file pins torch==1.13.1, a years-old release that will clobber your working PyTorch install and can take ComfyUI down with it - the classic custom-node dependency conflict. Skip it; the node runs fine on whatever the environment already ships.

    The gotchas that will actually bite you

    • It needs internet, every run. Every layer image is fetched live from src over HTTP via requests. A dead URL, slow host, or a server that blocks hotlinking errors out the whole node mid-run. There's no caching.
    • Strict JSON. It must be valid JSON containing the json_img key, or you get an "Invalid JSON format" / "missing 'json_img' key" error. The common failure is pasting in the inner json array and forgetting the json_img wrapper.
    • Zeroes get silently dropped. Layers with width, height, or scale of 0 are skipped, so a half-written scene renders missing pieces instead of telling you why.
    • It's unmaintained. Last commit was mid-2024, and it has essentially no community footprint. It works for what it does, but don't expect fixes or features.

    None of this is a reason to avoid it if you're the target audience. It's a small, honest tool that solves a specific automation problem. Just remember what it is: a layout renderer that talks JSON and answers in base64.

    Categorysd

    Inputs (1)

    NameTypeDefaultDescription
    json_imgSTRING

    Outputs (2)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING