Update comfyui-impact-pack.py

crop_size patch for more predictable upscale size
This commit is contained in:
ltdrdata
2023-04-12 23:45:12 +09:00
parent b0fe7a2c75
commit ef8b9fe787
+3 -6
View File
@@ -333,12 +333,9 @@ def make_crop_region(w, h, bbox, crop_factor):
bbox_w = x2-x1
bbox_h = y2-y1
# multiply and normalize size
# multiply: contains enough around context
# normalize: make sure size to be times of 64 and minimum size must be greater equal than 64
crop_w = max(64, (bbox_w * crop_factor // 64) * 64)
crop_h = max(64, (bbox_h * crop_factor // 64) * 64)
crop_w = bbox_w * crop_factor
crop_h = bbox_h * crop_factor
kernel_x = x1 + bbox_w / 2
kernel_y = y1 + bbox_h / 2