Skip to content

Commit 4e30381

Browse files
feat: Improve ResizeImageMaskNode UX with tooltips and search aliases (Comfy-Org#12013)
- Add search_aliases for discoverability: resize, scale, dimensions, etc. - Add node description for hover tooltip - Add tooltips to all inputs explaining their behavior - Reorder options: most common (scale dimensions) first, most technical (scale to multiple) last Addresses user feedback that 'resize' search returned nothing useful and options like 'match size' and 'scale to multiple' were not self-explanatory.
1 parent bbb8864 commit 4e30381

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

comfy_extras/nodes_post_processing.py

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -420,47 +420,63 @@ class ResizeTypedDict(TypedDict):
420420
@classmethod
421421
def define_schema(cls):
422422
template = io.MatchType.Template("input_type", [io.Image, io.Mask])
423-
crop_combo = io.Combo.Input("crop", options=cls.crop_methods, default="center")
423+
crop_combo = io.Combo.Input(
424+
"crop",
425+
options=cls.crop_methods,
426+
default="center",
427+
tooltip="How to handle aspect ratio mismatch: 'disabled' stretches to fit, 'center' crops to maintain aspect ratio.",
428+
)
424429
return io.Schema(
425430
node_id="ResizeImageMaskNode",
426431
search_aliases=["scale image", "scale mask"],
427432
display_name="Resize Image/Mask",
433+
description="Resize an image or mask using various scaling methods.",
428434
category="transform",
435+
search_aliases=["resize", "resize image", "resize mask", "scale", "scale image", "image resize", "change size", "dimensions", "shrink", "enlarge"],
429436
inputs=[
430437
io.MatchType.Input("input", template=template),
431-
io.DynamicCombo.Input("resize_type", options=[
432-
io.DynamicCombo.Option(ResizeType.SCALE_BY, [
433-
io.Float.Input("multiplier", default=1.00, min=0.01, max=8.0, step=0.01),
438+
io.DynamicCombo.Input(
439+
"resize_type",
440+
tooltip="Select how to resize: by exact dimensions, scale factor, matching another image, etc.",
441+
options=[
442+
io.DynamicCombo.Option(ResizeType.SCALE_DIMENSIONS, [
443+
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target width in pixels. Set to 0 to auto-calculate from height while preserving aspect ratio."),
444+
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target height in pixels. Set to 0 to auto-calculate from width while preserving aspect ratio."),
445+
crop_combo,
434446
]),
435-
io.DynamicCombo.Option(ResizeType.SCALE_DIMENSIONS, [
436-
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1),
437-
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1),
438-
crop_combo,
447+
io.DynamicCombo.Option(ResizeType.SCALE_BY, [
448+
io.Float.Input("multiplier", default=1.00, min=0.01, max=8.0, step=0.01, tooltip="Scale factor (e.g., 2.0 doubles size, 0.5 halves size)."),
439449
]),
440-
io.DynamicCombo.Option(ResizeType.SCALE_LONGER_DIMENSION, [
441-
io.Int.Input("longer_size", default=512, min=0, max=MAX_RESOLUTION, step=1),
450+
io.DynamicCombo.Option(ResizeType.SCALE_LONGER_DIMENSION, [
451+
io.Int.Input("longer_size", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="The longer edge will be resized to this value. Aspect ratio is preserved."),
442452
]),
443-
io.DynamicCombo.Option(ResizeType.SCALE_SHORTER_DIMENSION, [
444-
io.Int.Input("shorter_size", default=512, min=0, max=MAX_RESOLUTION, step=1),
453+
io.DynamicCombo.Option(ResizeType.SCALE_SHORTER_DIMENSION, [
454+
io.Int.Input("shorter_size", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="The shorter edge will be resized to this value. Aspect ratio is preserved."),
445455
]),
446-
io.DynamicCombo.Option(ResizeType.SCALE_WIDTH, [
447-
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1),
456+
io.DynamicCombo.Option(ResizeType.SCALE_WIDTH, [
457+
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target width in pixels. Height auto-adjusts to preserve aspect ratio."),
448458
]),
449-
io.DynamicCombo.Option(ResizeType.SCALE_HEIGHT, [
450-
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1),
459+
io.DynamicCombo.Option(ResizeType.SCALE_HEIGHT, [
460+
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target height in pixels. Width auto-adjusts to preserve aspect ratio."),
451461
]),
452-
io.DynamicCombo.Option(ResizeType.SCALE_TOTAL_PIXELS, [
453-
io.Float.Input("megapixels", default=1.0, min=0.01, max=16.0, step=0.01),
462+
io.DynamicCombo.Option(ResizeType.SCALE_TOTAL_PIXELS, [
463+
io.Float.Input("megapixels", default=1.0, min=0.01, max=16.0, step=0.01, tooltip="Target total megapixels (e.g., 1.0 ≈ 1024×1024). Aspect ratio is preserved."),
454464
]),
455-
io.DynamicCombo.Option(ResizeType.MATCH_SIZE, [
456-
io.MultiType.Input("match", [io.Image, io.Mask]),
457-
crop_combo,
465+
io.DynamicCombo.Option(ResizeType.MATCH_SIZE, [
466+
io.MultiType.Input("match", [io.Image, io.Mask], tooltip="Resize input to match the dimensions of this reference image or mask."),
467+
crop_combo,
458468
]),
459-
io.DynamicCombo.Option(ResizeType.SCALE_TO_MULTIPLE, [
460-
io.Int.Input("multiple", default=8, min=1, max=MAX_RESOLUTION, step=1),
469+
io.DynamicCombo.Option(ResizeType.SCALE_TO_MULTIPLE, [
470+
io.Int.Input("multiple", default=8, min=1, max=MAX_RESOLUTION, step=1, tooltip="Resize so width and height are divisible by this number. Useful for latent alignment (e.g., 8 or 64)."),
461471
]),
462-
]),
463-
io.Combo.Input("scale_method", options=cls.scale_methods, default="area"),
472+
],
473+
),
474+
io.Combo.Input(
475+
"scale_method",
476+
options=cls.scale_methods,
477+
default="area",
478+
tooltip="Interpolation algorithm. 'area' is best for downscaling, 'lanczos' for upscaling, 'nearest-exact' for pixel art.",
479+
),
464480
],
465481
outputs=[io.MatchType.Output(template=template, display_name="resized")]
466482
)

0 commit comments

Comments
 (0)