ComfyUI Node

Genfocus Condition

Pack an image into a Genfocus condition (with its own LoRA and position)

By EricRollei·Created 8 months ago·Updated 4 months ago· 19
Genfocus Condition
  • image
  • condition
adapterdeblurring
position_offset_h0
position_offset_w0
position_scale1.0
no_preprocessfalse

Genfocus generation isn't img2img in the usual sense - it's a multi-branch conditional diffusion where each input image is wrapped in a Condition object that carries its own LoRA adapter and its own position in the latent frame. GenfocusCondition is the node that wraps a plain IMAGE into that GENFOCUS_CONDITION object, ready to plug into Genfocus Generate. If you're building a custom multi-condition workflow, this is your packaging step.

What the knobs actually do

  • image - the condition input. Usually your source photo.
  • adapter (deblurring) - which LoRA this condition gets tagged with: deblurring, bokeh, or none. This is how you tell the pipeline that this particular branch is a content/structure input versus a defocus-map input. The main branch never carries a LoRA in Genfocus - the adapters live on the conditions.
  • position_offset_h / position_offset_w (0) - offset this condition's position embeddings in the frame, in pixels. This is a real paper trick: the demo deblur uses a black structure condition offset vertically by 32px to help the model separate "structure" from "content". You can use it to nudge where in the latent frame a condition sits.
  • position_scale (1.0) - scales the position embedding. Subtle; most workflows leave it.
  • no_preprocess (false) - skip VAE preprocessing. Turn this on when you're feeding a raw tensor (like a defocus map) instead of a photo. It's the escape hatch that keeps normalized maps from being re-encoded as if they were photographs.

One output: condition.

Where it fits

The convenience nodes (Genfocus Deblur, Genfocus Bokeh) build their own conditions internally, so you only reach for this node when you're driving Genfocus Generate directly - for example stacking an input image and a structure mask as separate conditions, or combining a deblurring condition with a bokeh condition in a single pass. The node takes the first image in a batch tensor and converts it to PIL internally (or passes tensors through untouched when no_preprocess is on).

Practical notes

  • The adapter tag must exist on the pipeline. If you tag a condition bokeh but your pipeline never loaded the bokeh LoRA, the condition is effectively inert. The loaders activate whatever adapters they're given - pick accordingly.
  • Position offsets are in pixel units, can be negative, and are clamped to ±100. The vertical-offset structure-condition trick from the demo is the one genuinely useful preset here.
  • If the result ignores a condition, check the console log - the pipeline prints which adapter is active per run, which tells you whether your condition's adapter was even in play.

Install is just the pack: ComfyUI Manager ("Refocus - Generative Refocusing") or git clone https://github.com/EricRollei/comfyui-refocus, plus pip install diffusers transformers accelerate peft and a Genfocus pipeline from either loader. No models of its own - it's pure plumbing.

CategoryGenfocus

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
adapterCOMBOdeblurringLoRA adapter to use for this condition
position_offset_hoptINT0-100–100Height offset for position embeddings
position_offset_woptINT0-100–100Width offset for position embeddings
position_scaleoptFLOAT1.00.1–2Scale factor for position embeddings
no_preprocessoptBOOLEANfalseSkip VAE preprocessing (for tensor inputs like defocus maps)

Outputs (1)

NameTypeDescription
conditionGENFOCUS_CONDITION