From 3aac72f95db1d1fc4ef5d56d10f7dc2cf13aa103 Mon Sep 17 00:00:00 2001 From: chflame Date: Mon, 26 Feb 2024 20:05:35 +0800 Subject: [PATCH] ImageAutoCrop node add detect_mask option in aspect_ratio --- py/image_auto_crop.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/image_auto_crop.py b/py/image_auto_crop.py index 2e6c866..5020c50 100644 --- a/py/image_auto_crop.py +++ b/py/image_auto_crop.py @@ -12,7 +12,7 @@ class ImageAutoCrop: def INPUT_TYPES(self): matting_method_list = ['RMBG 1.4', 'SegmentAnything'] detect_mode = ['min_bounding_rect', 'max_inscribed_rect'] - ratio_list = ['1:1', '3:2', '4:3', '16:9', '2:3', '3:4', '9:16', 'custom', 'original'] + ratio_list = ['1:1', '3:2', '4:3', '16:9', '2:3', '3:4', '9:16', 'custom', 'detect_mask'] return { "required": { "image": ("IMAGE", ), # @@ -65,7 +65,7 @@ class ImageAutoCrop: if aspect_ratio == 'custom': ratio = proportional_width / proportional_height - elif aspect_ratio == 'original': + elif aspect_ratio == 'detect_mask': ratio = 0 else: s = aspect_ratio.split(":") @@ -118,7 +118,7 @@ class ImageAutoCrop: crop_boxs.append(crop_box) if len(crop_boxs) > 0: # 批量图强制使用同一尺寸 crop_box = crop_boxs[0] - if aspect_ratio == 'original': + if aspect_ratio == 'detect_mask': ratio = crop_box[2] / crop_box[3] target_width, target_height = calculate_side_by_ratio(crop_box[2], crop_box[3], ratio, longest_side=side_limit)