Nodes/ComfyUI Level Pixel/Cropped Free Size Parameters [LP]
ComfyUI Node

Cropped Free Size Parameters [LP]

Sizing Inpaint Crop relative to the mask, not a target resolution

By LevelPixel·Created 2 years ago·Updated 6 months ago· 31
Cropped Free Size Parameters [LP]
  • mask
  • optional_context_mask
  • cropped_size_parameters
rescale_factor2.00
cropping_formfree form

The third of four sizing-parameter nodes in this pack that plug into InpaintCrop-LP's dedicated sizing pin - and the one that doesn't chase a target resolution at all. Instead of aiming for a specific pixel size the way CroppedAspectSizeParameters-LP does, this one just scales whatever the mask's natural bounding box already is, by a multiplier you set.

Why "free" size, and when you'd want it

CroppedAspectSizeParameters-LP is built for consistency - hit roughly the same target resolution no matter what shape mask you're feeding it. This node is built for the opposite instinct: let the crop be exactly as big or small as the mask actually calls for, scaled proportionally rather than snapped to a fixed target. That matters when your masks vary a lot in size across a batch - a tiny blemish fix next to a full-face repaint - and forcing everything to the same target_size would either upscale a tiny mask into blur or downscale a huge one into mush. Free-size sidesteps that by keeping the crop's size tied to the mask itself.

How it works

rescale_factor multiplies the mask's own bounding-box dimensions - a factor of 2 (the default) doubles the crop area beyond the tight mask bounds, giving the model extra surrounding context to blend into; a factor closer to 1 stays tight to just the masked region. cropping_form then decides the shape: free form (the default) keeps whatever aspect ratio the mask's bounding box naturally has, while square form forces the final crop to be a square regardless of the mask's actual proportions.

The inputs and outputs that matter

  • mask - the region the crop is scaled relative to.
  • rescale_factor - FLOAT, default 2, range 0.01–100. How much bigger (or smaller) than the mask's tight bounding box the crop should be.
  • cropping_form - free form (keeps the mask's own aspect ratio) or square form (forces 1:1).
  • optional_context_mask - an optional MASK for factoring in extra visible area without it being the region that's actually edited.
  • Output - cropped_size_parameters (CROPPEDSIZEDATA), wired into InpaintCrop-LP's sizing pin.

How to install it

ComfyUI Manager: search "ComfyUI Level Pixel" or ComfyUI-LevelPixel, install, restart - updates automatically via Manager's "Update ALL." Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git

Restart ComfyUI. No models, no extra dependencies.

Common issues & troubleshooting

Crops come out very different sizes across a batch and downstream steps don't like that. That's expected with free sizing - it's proportional to each mask, not fixed. If your downstream pipeline needs consistent dimensions, this is the wrong sizing node for the job; reach for CroppedForsedSizeParameters-LP (fixed pixels) or CroppedRangedSizeParameters-LP (min/max bounds) instead.

A tiny mask is producing a crop that's too tight, cutting off useful surrounding context. Raise rescale_factor - the default of 2 already doubles beyond the tight bounding box, but a very small mask may still want more breathing room for a model to blend convincingly.

You set square form and the result looks stretched or oddly cropped compared to the mask's real shape. That's the setting doing its job - forcing a square crop from a non-square mask means the crop extends unevenly in whichever direction is needed to make a square, which can pull in more of one side than the other.

CategoryLevelPixel/Inpaint

Inputs (4)

NameTypeDefaultDescription
maskMASK
rescale_factorFLOAT2.000.01–100
cropping_formCOMBOfree form2 options: free form, square form
optional_context_maskoptMASK

Outputs (1)

NameTypeDescription
cropped_size_parametersCROPPEDSIZEDATA