diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-03-25 13:15:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-25 13:15:29 +0000 |
commit | 9b2dcb04bcf3a8ef10bfd9b2aac71e478132ff63 (patch) | |
tree | 2f968665d902f887147d2f473612e637e1dc74b2 /modules/processing.py | |
parent | 252f15e046b06cdcf07caa2ec97a15462950b92a (diff) | |
parent | 68953a4705b7f04d82f6cfb4eb2e67756ec666ca (diff) | |
download | stable-diffusion-webui-gfx803-9b2dcb04bcf3a8ef10bfd9b2aac71e478132ff63.tar.gz stable-diffusion-webui-gfx803-9b2dcb04bcf3a8ef10bfd9b2aac71e478132ff63.tar.bz2 stable-diffusion-webui-gfx803-9b2dcb04bcf3a8ef10bfd9b2aac71e478132ff63.zip |
Merge branch 'master' into master
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/processing.py b/modules/processing.py index 59717b4c..2e5a363f 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -689,6 +689,22 @@ 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:
+ image_mask = p.mask_for_overlay.convert('RGB')
+ image_mask_composite = Image.composite(image.convert('RGBA').convert('RGBa'), Image.new('RGBa', image.size), p.mask_for_overlay.convert('L')).convert('RGBA')
+
+ if opts.save_mask:
+ images.save_image(image_mask, p.outpath_samples, "", seeds[i], prompts[i], opts.samples_format, info=infotext(n, i), p=p, suffix="-mask")
+
+ if opts.save_mask_composite:
+ images.save_image(image_mask_composite, p.outpath_samples, "", seeds[i], prompts[i], opts.samples_format, info=infotext(n, i), p=p, suffix="-mask-composite")
+
+ if opts.return_mask:
+ output_images.append(image_mask)
+
+ if opts.return_mask_composite:
+ output_images.append(image_mask_composite)
+
del x_samples_ddim
devices.torch_gc()
|