Only handle image mask if any option enabled

This commit is contained in:
catboxanon 2023-04-14 17:24:55 -04:00 committed by GitHub
parent 3af152d488
commit fbab3fc6d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -706,7 +706,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
image.info["parameters"] = text
output_images.append(image)
if hasattr(p, 'mask_for_overlay') and p.mask_for_overlay:
if hasattr(p, 'mask_for_overlay') and p.mask_for_overlay and any([opts.save_mask, opts.save_mask_composite, opts.return_mask, opts.return_mask_composite]):
image_mask = p.mask_for_overlay.convert('RGB')
image_mask_composite = Image.composite(image.convert('RGBA').convert('RGBa'), Image.new('RGBa', image.size), images.resize_image(2, p.mask_for_overlay, image.width, image.height).convert('L')).convert('RGBA')