Skip to content

Commit

Permalink
Merge pull request #14177 from catboxanon/fix/mask-composite-save
Browse files Browse the repository at this point in the history
Fix `save_samples` being checked early when saving masked composite
  • Loading branch information
AUTOMATIC1111 authored Dec 3, 2023
2 parents fed5b1d + 83e8c32 commit b4776ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,14 +938,14 @@ def infotext(index=0, use_main_prompt=False):
if opts.enable_pnginfo:
image.info["parameters"] = text
output_images.append(image)
if save_samples and 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]):
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')

if opts.save_mask:
if save_samples and opts.save_mask:
images.save_image(image_mask, p.outpath_samples, "", p.seeds[i], p.prompts[i], opts.samples_format, info=infotext(i), p=p, suffix="-mask")

if opts.save_mask_composite:
if save_samples and opts.save_mask_composite:
images.save_image(image_mask_composite, p.outpath_samples, "", p.seeds[i], p.prompts[i], opts.samples_format, info=infotext(i), p=p, suffix="-mask-composite")

if opts.return_mask:
Expand Down

0 comments on commit b4776ea

Please sign in to comment.