From 08dbc0c7380c5110361d2be19c5c684b96a3266e Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Wed, 18 Jan 2023 08:29:55 -0600 Subject: [PATCH] fix(api): check image size before blending --- api/onnx_web/pipeline.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/onnx_web/pipeline.py b/api/onnx_web/pipeline.py index 3dd0c637..02d1f0a6 100644 --- a/api/onnx_web/pipeline.py +++ b/api/onnx_web/pipeline.py @@ -182,7 +182,11 @@ def run_inpaint_pipeline( num_inference_steps=params.steps, width=size.width, ).images[0] - image = ImageChops.blend(source_image, image, strength) + + if image.size == source_image.size: + image = ImageChops.blend(source_image, image, strength) + else: + print('output image size does not match source, skipping post-blend') if upscale.faces or upscale.scale > 1: image = upscale_resrgan(ctx, upscale, image)