Nodes/NKD Klein Tools/😺NKD Klein Presampling
ComfyUI Node

😺NKD Klein Presampling

All-in-one starting point for a Flux Klein workflow. Connect your model, prompt and reference image, and this node prepares everything the sampler needs. Pair it with NKD Klein Postsampling at the end of the chain — between the two goes your sampler.

By Nekodificador·Created 4 months ago·Updated 27 days ago· 71
😺NKD Klein Presampling
  • model
  • clip
  • vae
  • ref_images
  • mask
  • model
  • positive
  • negative
  • latent
  • bundle
  • mask
  • ref_0
positive
negative
pin_modelfalse
resizetrue
aspect_ratioAs Reference
megapixels1.0
custom_width1024
custom_height1024
image_fitNative
outpaint_fillGray
slide0.50
bypass_referencefalse
reference_strength0
mask_expand20
mask_blur10
inpaint_blend1.00
use_detailingfalse
detail_padding50
Category😺NKD Nodes/Klein

Inputs (23)

NameTypeDefaultDescription
modelMODELYour Flux Klein model.
clipCLIPThe text encoder that goes with the model.
vaeVAEThe VAE that goes with the model.
positiveSTRINGDescribe what you want in the image.
negativeSTRINGDescribe what you don't want.
pin_modelBOOLEANfalseKeeps the model in your graphics card so it doesn't reload between runs. Faster, but only turn it on if you have plenty of VRAM.
resizeBOOLEANtrueOn (default): the node sizes the image for you from Aspect Ratio and Megapixels. Off: the node leaves every image at its own size and works at your input image's native size — use this when you want to handle sizing yourself elsewhere. Turning it off hides Aspect Ratio and Megapixels.
aspect_ratioCOMBOAs ReferenceThe shape of the final image. 'As Reference' copies the shape of your input image. 'Custom' lets you type any size you want.
megapixelsFLOAT1.00.1–4How big the final image should be, in megapixels. Bigger values mean more detail and sharper results, but also slower generation and more VRAM needed.
custom_widthINT102464–8192Width in pixels. Only used when Aspect Ratio is set to Custom.
custom_heightINT102464–8192Height in pixels. Only used when Aspect Ratio is set to Custom.
image_fitCOMBONativeHow to handle your input image when the chosen canvas has a different shape. Only matters when the canvas shape doesn't match the image. Native: the model rebuilds the canvas around your subject without distorting it (best for changing aspect ratio or upscaling). Center Crop: cuts the image to fit the canvas (no distortion, loses the edges). Outpaint: fits the whole image inside the canvas and lets the model fill in the surrounding space.
outpaint_fillCOMBOGrayWhat to put in the empty space around your image when using Outpaint. Gray is neutral and lets the model decide freely. Black or White nudge it toward dark or bright surroundings. Smart fills the space with a soft continuation of the image so the model has a natural starting point. Only used with Outpaint.
slideFLOAT0.500–1Shifts the image off-centre. With Outpaint it moves the image within the empty space; with Center Crop it chooses which part of the image is kept. 0.5 stays centred. The direction follows the canvas shape: a taller canvas moves it up (toward 1) or down (toward 0); a wider canvas moves it right (toward 1) or left (toward 0). Used with Outpaint and Center Crop.
bypass_referenceBOOLEANfalseTurn off the model's ability to look at your reference image while it works. Leave it off in most cases — turn it on only if you want the model to ignore the reference completely.
reference_strengthINT0-2–10How tightly the result follows the layout of your reference image. 0 is the default (balanced — good for most edits). Higher values lock the result more strictly to the original layout (useful when things need to line up perfectly with the input). Negative values give the model more creative freedom to reinterpret what it sees.
ref_imagesCOMFY_AUTOGROW_V3Connect your input image to ref_0. More slots will appear automatically if you want to add extra reference images.
mask_expandINT200–512Makes the masked area a bit bigger so the regenerated region blends naturally with its surroundings.
mask_blurINT100–512Softens the edges of the mask so the transition between the new and old parts of the image looks smoother.
inpaint_blendFLOAT1.000–1Controls how sharp the transition is between the regenerated area and the original image. 0.0 gives a clean cut along the mask edge; higher values fade the two together more gently.
use_detailingBOOLEANfalseZooms into the masked area before regenerating it, so you get more detail in small zones (faces, hands, eyes…) without having to upscale the whole image. Needs both an input image and a mask.
detail_paddingINT500–512How much extra space around the mask the zoom should include. More padding gives the model more context, less padding focuses tighter on the masked area.
maskoptMASKPaint a mask to tell the model which part of the image to regenerate. White areas get redone, black areas stay the same. Connecting a mask switches the node into inpainting mode.

Outputs (7)

NameTypeDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
latentLATENT
bundleNKD_KLEIN_BUNDLE
maskMASKThe mask after expanding and softening — useful if a downstream node needs to know which area was regenerated.
ref_0IMAGEYour input image after the Image Fit / Outpaint preprocessing, at the final canvas size. Handy to feed into other parts of the workflow that need the same prepared image.