ComfyUI Node

LCMGenerate

This pack's main inpaint/outpaint workhorse

By taabata·Created 3 years ago·Updated 2 years ago· 259
LCMGenerate
  • image
  • mask
  • original_image
  • pipe
  • reference_image
  • IMAGE
mode
seed0
text
steps4
width512
height512
cfg8.0
outpaint_size256
outpaint_direction
batch1
prompt_weighting
style_fidelity0.5
Reference_Only
oupaint_quality

This is the node the whole pack is named after. LCMGenerate is the big single-node inpaint/outpaint sampler: give it an image, a mask, and a prompt, and it runs the LCM_Dreamshaper_v7 pipeline that LCMLoader built, then composites the result back over your original. It's the thing to reach for when you want the classic inpainting workflow from the pack's screenshots without assembling it out of native ComfyUI parts.

How it works

Feed it an image, a mask (which regions to regenerate), and an original_image (what to keep). The code converts all three from ComfyUI tensors back to PIL images, runs the pipeline with lcm_origin_steps=50, and then - the interesting part - does the compositing itself in Python with Pillow. In Inpaint mode it returns the generated image. In Outpaint mode it builds a larger canvas, pastes your original in, and stitches the generated expansion alongside it, with a direction you choose.

The inputs that matter

Most of these appear on every generation node in the pack, so learning them here pays off.

  • mode - Inpaint or Outpaint. This changes what the node does with the output.
  • image, mask, original_image - the inpaint trio. The mask is white where you want regeneration; the other two feed the composite.
  • outpaint_size (default 256) and outpaint_direction (left/right/top/bottom) - how far and which way to extend the canvas when mode is Outpaint.
  • oupaint_quality - higher runs a second pass over the seam with a blurred mask so the join isn't a hard line. Costs time, fixes the obvious stitch artifact. Worth it.
  • steps (default 4) and cfg (default 8). Here's the trap: this is an LCM model, and the distillation rules say CFG should sit around 1–2, not 8. The author's default is hot. Lower cfg toward 1–2 for the characteristic clean LCM look; keep the default if you want more contrast and don't mind oversaturation. Steps of 4–8 is the whole point - that's the speed.
  • text, seed, batch - standard. Note that with batch > 1 the node re-randomizes the seed each pass.
  • prompt_weighting - enable routes the prompt through compel, which gives you +/- emphasis. The README is blunt: it requires CPU inference (select CPU in LCMLoader) because the GPU path throws an error the author never fixed.
  • Reference_Only - enable uses reference_image + style_fidelity to steer generation toward a reference's style, so outpaint and inpaint match the source art better. This is the "promptless" trick from the author's Reddit posts.

The single output is an IMAGE - wire it to a preview or save node (the pack ships SaveImage_LCM for this).

Setup and the usual pain

You need the pack installed and the LCM_Dreamshaper_v7 diffusers model in ComfyUI/models/diffusers (blank model_path in LCMLoader resolves there). If you skipped the model download you'll get the loader's "couldn't connect to huggingface.co" error before this node ever runs. Windows path quirks also crop up here, since all the image handling is Pillow + manual string paths.

One honest caveat: this is October 2023 code, written when the author was actively posting "Workflow Included" LCM demos to r/StableDiffusion. It works, and it's genuinely fast, but the seams show - the default CFG, the CPU-only prompt weighting, the re-randomized batch seeds. Treat it as a fun, fast pipeline to iterate with, not as polished tooling. For final renders, take the same concept to native ComfyUI nodes and a proper LCM sampler.

CategoryLCM_Nodes/nodes

Inputs (19)

NameTypeDefaultDescription
modeCOMBO2 options: Inpaint, Outpaint
seedINT00–18446744073709550000
textSTRING
stepsINT40–360
widthINT5120–5000
heightINT5120–5000
cfgFLOAT8.00–30
imageIMAGE
maskIMAGE
original_imageIMAGE
outpaint_sizeINT2560–5000
outpaint_directionCOMBO4 options: left, right, top, bottom
pipeclass
batchINT11–100
prompt_weightingCOMBO2 options: disable, enable
reference_imageIMAGE
style_fidelityFLOAT0.50–1
Reference_OnlyCOMBO2 options: disable, enable
oupaint_qualityCOMBO2 options: higher, lower

Outputs (1)

NameTypeDescription
IMAGEIMAGE