Unverified Commit e93f582a authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge pull request #11748 from huaizong/fix/x/resize-less-than-two-pixel-error

fix: check fill size none zero when resize  (fixes #11425)
parents e5ca9877 6c0d5d11
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -306,10 +306,12 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None):

        if ratio < src_ratio:
            fill_height = height // 2 - src_h // 2
            if fill_height > 0:
                res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0))
                res.paste(resized.resize((width, fill_height), box=(0, resized.height, width, resized.height)), box=(0, fill_height + src_h))
        elif ratio > src_ratio:
            fill_width = width // 2 - src_w // 2
            if fill_width > 0:
                res.paste(resized.resize((fill_width, height), box=(0, 0, 0, height)), box=(0, 0))
                res.paste(resized.resize((fill_width, height), box=(resized.width, 0, resized.width, height)), box=(fill_width + src_w, 0))