Skip to content

Commit 79cdbc8

Browse files
feat: Improve ResizeImageMaskNode UX with tooltips and search aliases (Comfy-Org#12040)
- 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 f443b9f commit 79cdbc8

1 file changed

Lines changed: 41 additions & 26 deletions

File tree

comfy_extras/nodes_post_processing.py

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -420,47 +420,62 @@ 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",
426-
search_aliases=["scale image", "scale mask"],
427431
display_name="Resize Image/Mask",
432+
description="Resize an image or mask using various scaling methods.",
428433
category="transform",
434+
search_aliases=["resize", "resize image", "resize mask", "scale", "scale image", "scale mask", "image resize", "change size", "dimensions", "shrink", "enlarge"],
429435
inputs=[
430436
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),
437+
io.DynamicCombo.Input(
438+
"resize_type",
439+
tooltip="Select how to resize: by exact dimensions, scale factor, matching another image, etc.",
440+
options=[
441+
io.DynamicCombo.Option(ResizeType.SCALE_DIMENSIONS, [
442+
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."),
443+
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."),
444+
crop_combo,
434445
]),
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,
446+
io.DynamicCombo.Option(ResizeType.SCALE_BY, [
447+
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)."),
439448
]),
440-
io.DynamicCombo.Option(ResizeType.SCALE_LONGER_DIMENSION, [
441-
io.Int.Input("longer_size", default=512, min=0, max=MAX_RESOLUTION, step=1),
449+
io.DynamicCombo.Option(ResizeType.SCALE_LONGER_DIMENSION, [
450+
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."),
442451
]),
443-
io.DynamicCombo.Option(ResizeType.SCALE_SHORTER_DIMENSION, [
444-
io.Int.Input("shorter_size", default=512, min=0, max=MAX_RESOLUTION, step=1),
452+
io.DynamicCombo.Option(ResizeType.SCALE_SHORTER_DIMENSION, [
453+
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."),
445454
]),
446-
io.DynamicCombo.Option(ResizeType.SCALE_WIDTH, [
447-
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1),
455+
io.DynamicCombo.Option(ResizeType.SCALE_WIDTH, [
456+
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."),
448457
]),
449-
io.DynamicCombo.Option(ResizeType.SCALE_HEIGHT, [
450-
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1),
458+
io.DynamicCombo.Option(ResizeType.SCALE_HEIGHT, [
459+
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."),
451460
]),
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),
461+
io.DynamicCombo.Option(ResizeType.SCALE_TOTAL_PIXELS, [
462+
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."),
454463
]),
455-
io.DynamicCombo.Option(ResizeType.MATCH_SIZE, [
456-
io.MultiType.Input("match", [io.Image, io.Mask]),
457-
crop_combo,
464+
io.DynamicCombo.Option(ResizeType.MATCH_SIZE, [
465+
io.MultiType.Input("match", [io.Image, io.Mask], tooltip="Resize input to match the dimensions of this reference image or mask."),
466+
crop_combo,
458467
]),
459-
io.DynamicCombo.Option(ResizeType.SCALE_TO_MULTIPLE, [
460-
io.Int.Input("multiple", default=8, min=1, max=MAX_RESOLUTION, step=1),
468+
io.DynamicCombo.Option(ResizeType.SCALE_TO_MULTIPLE, [
469+
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)."),
461470
]),
462-
]),
463-
io.Combo.Input("scale_method", options=cls.scale_methods, default="area"),
471+
],
472+
),
473+
io.Combo.Input(
474+
"scale_method",
475+
options=cls.scale_methods,
476+
default="area",
477+
tooltip="Interpolation algorithm. 'area' is best for downscaling, 'lanczos' for upscaling, 'nearest-exact' for pixel art.",
478+
),
464479
],
465480
outputs=[io.MatchType.Output(template=template, display_name="resized")]
466481
)

0 commit comments

Comments
 (0)