Nodes/BaiduMeux_Comfy Tools/Meux Smart Exact Resize
ComfyUI Node

Meux Smart Exact Resize

Crop AND pad, decided for you

By fchangjun·Created about a year ago·Updated 5 months ago· 4
Meux Smart Exact Resize
  • image
  • IMAGE
target_width1000
target_height600
modeauto
anchorcenter
safe_margin_percent0.10
padding_modeblur_extend

Every resize node in ComfyUI assumes you know what you want. Want exactly 1000×600? Fine - but if your source is 1200×500, do you crop the sides or pad the top and bottom? MeuxSmartExactResize is the node that stops asking and just produces the exact size you specified, picking crop or pad per image based on what's safe - and offering three different padding styles when padding is the answer.

It's the kind of node that matters most in batch work, where one workflow has to swallow images of wildly different aspect ratios and emit a single fixed size.

How it works

For each image in the batch, it decides between two operations. In auto mode: if the source is big enough in both dimensions and cropping won't eat your subject (judged by safe_margin_percent), it crops. Otherwise it pads. You can force either behavior with crop_only or pad_only.

Cropping anchors to center, top, bottom, left, or right - the anchor decides which part of the image survives the crop.

Padding has three styles, but don't trust all the names equally:

  • blur_extend (default) - the image is stretched to fill the canvas, heavily blurred, and the original pasted centered on top. That "blurred canvas behind the photo" look that's everywhere in thumbnails.
  • edge_extend - despite the name, the current code fills with a plain background rather than actually replicating edge pixels. Treat it as the cheap flat option.
  • solid_color - plain black bars.

Inputs: image, target_width, target_height, mode, anchor, safe_margin_percent, padding_mode. Output: a single IMAGE at exactly the target size.

The safe_margin_percent detail is the one that's easy to miss. It defaults to 0.1, meaning auto mode refuses to crop if the target would eat more than roughly a 10% margin around the edges of the source - protecting your subject from an over-aggressive crop.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/fchangjun/Comfyui_MultiSaveImage
cd Comfyui_MultiSaveImage
pip install -r requirements.txt

Or ComfyUI Manager → search "Baidu Meux ComfyTools" → restart.

Where people get burned

  • Crop eats the subject. Your safe_margin_percent is too small, or you're in crop_only on a mismatched aspect. Raise the margin or let auto decide.
  • Unexpected flat bars. That's solid_color, or edge_extend doing its thing. If you wanted the pretty blurred look, check padding_mode.
  • blur_extend on a huge image. The blur runs at full canvas size and can get slow on 4K targets; edge_extend is the cheap alternative when you don't care about aesthetics.

If your pipeline has a "everything comes out at this exact size" stage - thumbnails, batch compositing, feeding a fixed-aspect video model - this is the node that makes that stage one click instead of a chain of resize/center-crop/pad nodes you re-derive every time.

Categoryimage/resize

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
target_widthINT10001–4096
target_heightINT6001–4096
modeCOMBOauto3 options: auto, crop_only, pad_only
anchorCOMBOcenter5 options: center, top, bottom, left, right
safe_margin_percentFLOAT0.100–0.4
padding_modeCOMBOblur_extend3 options: solid_color, edge_extend, blur_extend

Outputs (1)

NameTypeDescription
IMAGEIMAGE