Constrain Resolution

ConstrainResolution

Intelligently resizes images to fit within resolution constraints while preserving aspect ratio. Perfect for preparing images for AI models with specific dimension requirements. 💡 USAGE TIPS: • Use 'Prioritize Min Resolution' to ensure images are never too small (may exceed max on one dimension) • Use 'Prioritize Max Resolution (Strict)' for hard VRAM limits (may go below min on one dimension) • Set 'Multiple Of' to 2 for most models, or higher values (8, 16, 32, 64) for optimal performance • 'Crop as Required' is enabled by default for immediate compatibility with strict dimension requirements • The node outputs both the resized image and the original for workflow flexibility

Pack: ComfyUI-ConstrainResolution

custom_nodes.ComfyUI-ConstrainResolution

Inputs (7)

NameTypeRequired
imageIMAGErequired
min_resINTrequired
max_resINTrequired
multiple_ofINTrequired
constraint_modeCOMBOrequired
crop_as_requiredBOOLEANrequired
crop_positionCOMBOrequired

Outputs (6)

NameType
resized_imageIMAGE
original_imageIMAGE
widthINT
heightINT
final_aspect_ratioFLOAT
original_aspect_ratioFLOAT