Nodes/ComfyUI_LC123_nodes/πŸ“ Aspect Ratio Simplifier
ComfyUI Node

πŸ“ Aspect Ratio Simplifier

Resize an image and/or mask to a target size. Size from input image/mask, or from a preset / custom width x height. Outputs: image, mask, width, height, empty latent, batch. Settings: resolution_source (image/mask vs custom/preset); aspect_ratio preset; custom_width/height; swap_dimensions; upscale_method (default lanczos); proportion (stretch|resize|crop|pad|total_pixels); crop_location; pad_color; divisible_by (e.g. 8); max_resolution (0=no clamp); batch_size (empty latent only).

By lonecatone23Β·Created 27 days agoΒ·Updated about 17 hours agoΒ· 9
πŸ“ Aspect Ratio Simplifier
  • image
  • mask
  • image
  • mask
  • width
  • height
  • latent
  • batch
  • resolution
β—„max_resolution2048β–Ί
β—„resolution_sourcefalseβ–Ί
β—„aspect_ratioβ–Ύβ–Ί
β—„custom_width1024β–Ί
β—„custom_height1024β–Ί
β—„swap_dimensionsβ–Ύβ–Ί
β—„upscale_methodlanczosβ–Ί
β—„proportioncropβ–Ί
β—„crop_locationcenterβ–Ί
β—„pad_color0, 0, 0β–Ί
β—„divisible_by8β–Ί
β—„batch_size1β–Ί
CategoryLC123

Inputs (14)

NameTypeDefaultDescription
max_resolutionINT20480–16384Clamp longer side. 0 = no clamp.
resolution_sourceBOOLEANfalseOff: size from image/mask. On: use preset or custom width x height.
aspect_ratioCOMBOPreset ratio when using custom/preset source.
custom_widthINT102416–16384Target width for custom size.
custom_heightINT102416–16384Target height for custom size.
swap_dimensionsCOMBOSwap width and height after size is chosen.
upscale_methodCOMBOlanczosResampling filter. Lanczos is a good default for photos.
proportionCOMBOcropstretch=force size; resize=fit inside; crop=fill+crop; pad=fit+letterbox; total_pixels=match pixel budget.
crop_locationCOMBOcenterCrop anchor when proportion is crop.
pad_colorSTRING0, 0, 0RGB for pad mode. 0-255 or 0-1.
divisible_byINT81–128Round width/height to a multiple of this (8 is typical for latents).
batch_sizeINT11–4096Empty latent batch. Image/mask batch is preserved from input.
imageoptIMAGEβ€”
maskoptMASKβ€”

Outputs (7)

NameTypeDescription
imageIMAGEβ€”
maskMASKβ€”
widthINTβ€”
heightINTβ€”
latentLATENTβ€”
batchINTβ€”
resolutionINTβ€”