Cropped Aspect Size Parameters [LP]
The default sizing mode for Inpaint Crop
- mask
- optional_context_mask
- cropped_size_parameters
The pack's own README singles this one out by name as "one of the key ones" - the parameter node behind Inpaint Crop's default "aspect size" mode, which "allows you to set the target resolution for the cut fragment, and the program itself calculates the required dimensions." If you use InpaintCrop-LP at all and haven't gone looking for its alternate sizing modes, this is almost certainly the sizing logic you're already running.
What it plugs into
InpaintCrop-LP has a special input pin built specifically to accept a bundle of sizing parameters, and this node is one of four in the pack that produce that bundle - each representing a different way of deciding how big the cropped fragment should be. This one is the "let it figure out the resolution from the mask's own shape, aiming for a target size" approach; its siblings (CroppedForsedSizeParameters-LP, CroppedFreeSizeParameters-LP, CroppedRangedSizeParameters-LP) cover a fixed pixel size, a scale-relative-to-the-mask approach, and a min/max range respectively.
How it works
Given a mask, it computes crop dimensions that respect the mask's aspect ratio while hitting your target_size - the same aspect-aware calculation this pack's standalone CalculateTargetSizeByMask-LP node exposes directly, just packaged here as the bundle InpaintCrop-LP expects. crop_size_mode then decides how the crop is allowed to relate to the mask-plus-context area it's sizing around - the node's own tooltip describes it plainly: "How to constrain the crop size relative to the mask+context area." auto lets it pick freely, no larger than mask keeps the crop from exceeding the mask+context bounds, and no smaller than mask guarantees the crop covers at least that whole area.
The inputs and outputs that matter
- mask - the region driving the size calculation.
- target_size - INT, default
1024, range 0–16384. The resolution the calculation aims for. - aspect_ratio_limit - FLOAT, default
2, range 1–100. Caps how far from square the result can stretch, so a thin sliver of a mask doesn't produce an absurdly elongated crop. - crop_size_mode -
auto/no larger than mask/no smaller than mask, per the tooltip above. - optional_context_mask - an optional MASK for keeping extra surrounding area factored into the size calculation without that area itself being the thing edited.
- Output - cropped_size_parameters (
CROPPEDSIZEDATA), wired straight intoInpaintCrop-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 - pure geometry.
Common issues & troubleshooting
Nothing seems to happen when you change these settings. Double-check cropped_size_parameters is actually wired into InpaintCrop-LP's dedicated sizing input - this node produces an opaque bundle type, not something you'd inspect or use standalone, so a missed connection here just leaves Inpaint Crop falling back to whatever its own default mode does.
Your crop is coming out a different shape than you expected. Work through crop_size_mode deliberately - no larger than mask and no smaller than mask are hard constraints that can override what target_size/aspect_ratio_limit alone would have produced, so if the result looks constrained in a way you didn't intend, this setting is the first thing to check.
You want a fixed pixel size regardless of the mask's shape. That's a different sizing philosophy - use CroppedForsedSizeParameters-LP instead, which skips the mask-aspect calculation entirely in favor of exact cropped_width/cropped_height values.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| target_size | INT | 10240–16384 | — |
| aspect_ratio_limit | FLOAT | 2.001–100 | — |
| crop_size_mode | COMBO | auto | How to constrain the crop size relative to the mask+context area. |
| optional_context_maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cropped_size_parameters | CROPPEDSIZEDATA | — |