Paint by Generated Example
Prompt a reference, then paint by it
- image
- mask
- model
- positive
- negative
- latent_image
- vae
- image
- example
The one node in this pack that works from a prompt
Every other paint-by-example node wants you to supply an example image. Paint by Generated Example is the exception: it generates the example for you. You hand it a normal txt2img stack - model, prompt, latent, VAE - and it first runs a full KSampler pass, then uses the resulting image as the "example" for a paint-by-example inpaint of your masked region. Prompt → reference → inpaint, all inside one node.
That's the feature, and it's also the honest framing: this is a roundabout pipeline. If you already have a reference picture, the simple or advanced node is faster and less weird. This one earns its keep when you have a description but no photo - "a red ceramic teapot on a wooden table" beats hunting the internet for the perfect teapot shot.
How it works (from the source)
The node calls ComfyUI's own common_ksampler with your model, positive, negative and latent_image at denoise=1 to generate an image, decodes the latent with your vae, and feeds the result as the example into the same paint-by-example inpaint the advanced node runs. Two quirks follow from that. First, the generation pass uses ComfyUI's sampler vocabulary - 44 samplers and 9 schedulers (simple, karras, exponential, and friends) - while the inpaint pass swaps in a diffusers scheduler, so the two lists don't line up and names ComfyUI knows but diffusers doesn't silently fall back to pndm. Second, the same seed drives both passes, so changing it re-rolls the whole thing consistently.
Inputs and outputs
- image, mask - the usual targets.
- model, positive, negative, latent_image, vae - the txt2img stack that produces the example.
- seed - default 0, shared across generation and inpaint.
- steps - default 30. cfg - default 5.
- sampler_name, scheduler - ComfyUI's native lists; they govern the example-generation pass.
Outputs are two images: image (the inpainted result) and example (what it generated as the reference). Wiring example to a Save Image node is a genuinely good habit - you want to see what the model based its fill on, because "paint by it" only ever gets you in the neighborhood.
Install and gotchas
The pack installs as usual: ComfyUI Manager, search "paint-by-example", or git clone https://github.com/phyblas/paint-by-example_comfyui into ComfyUI/custom_nodes, then restart. Dependencies are diffusers, torch, torchvision.
Watch the same two traps as its siblings: the first run downloads the >5GB Fantasy-Studio model from Hugging Face (no manual download, but a long wait), and a too-new transformers can break the pipeline import - the pack's answer is pip install transformers==4.40.0, an old pin that can collide with other nodes, so test it somewhere disposable first.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| model | MODEL | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 30 | — |
| cfg | FLOAT | 5.0 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| vae | VAE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| example | IMAGE | — |