From aadccd28cade254b6fe664ce3a81a9225070b39c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 27 Jan 2026 19:44:45 +0000 Subject: [PATCH] fix ResizeAndPadImage as well --- comfy_extras/nodes_images.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_images.py b/comfy_extras/nodes_images.py index cb4fb24a1..f1ac2971a 100644 --- a/comfy_extras/nodes_images.py +++ b/comfy_extras/nodes_images.py @@ -395,10 +395,15 @@ class ResizeAndPadImage(IO.ComfyNode): scale_w = target_width / orig_width scale_h = target_height / orig_height - scale = min(scale_w, scale_h) - new_width = int(orig_width * scale) - new_height = int(orig_height * scale) + # When aspect ratios match, scale directly to target to avoid precision loss from float multiplication + if scale_w == scale_h: + new_width = target_width + new_height = target_height + else: + scale = min(scale_w, scale_h) + new_width = int(orig_width * scale) + new_height = int(orig_height * scale) image_permuted = image.permute(0, 3, 1, 2)