Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
d3fdc4af
Commit
d3fdc4af
authored
Dec 03, 2023
by
w-e-w
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework mask and mask_composite logic
parent
b4776ea3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
modules/processing.py
modules/processing.py
+14
-15
No files found.
modules/processing.py
View file @
d3fdc4af
...
...
@@ -938,21 +938,20 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
if
opts
.
enable_pnginfo
:
image
.
info
[
"parameters"
]
=
text
output_images
.
append
(
image
)
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
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
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
:
output_images
.
append
(
image_mask
)
if
opts
.
return_mask_composite
:
output_images
.
append
(
image_mask_composite
)
if
hasattr
(
p
,
'mask_for_overlay'
)
and
p
.
mask_for_overlay
:
if
opts
.
return_mask
or
opts
.
save_mask
:
image_mask
=
p
.
mask_for_overlay
.
convert
(
'RGB'
)
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
.
return_mask
:
output_images
.
append
(
image_mask
)
if
opts
.
return_mask_composite
or
opts
.
save_mask_composite
:
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
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_composite
:
output_images
.
append
(
image_mask_composite
)
del
x_samples_ddim
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment