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
80873b15
Commit
80873b15
authored
Jan 02, 2024
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #14497
parent
1341b220
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
15 deletions
+25
-15
modules/img2img.py
modules/img2img.py
+0
-15
modules/infotext_utils.py
modules/infotext_utils.py
+12
-0
modules/processing.py
modules/processing.py
+13
-0
No files found.
modules/img2img.py
View file @
80873b15
...
@@ -222,21 +222,6 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
...
@@ -222,21 +222,6 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
if
shared
.
opts
.
enable_console_prompts
:
if
shared
.
opts
.
enable_console_prompts
:
print
(
f
"
\n
img2img: {prompt}"
,
file
=
shared
.
progress_print_out
)
print
(
f
"
\n
img2img: {prompt}"
,
file
=
shared
.
progress_print_out
)
if
mask
:
p
.
extra_generation_params
[
"Mask blur"
]
=
mask_blur
if
inpainting_mask_invert
is
not
None
:
p
.
extra_generation_params
[
"Mask mode"
]
=
inpainting_mask_invert
if
inpainting_fill
is
not
None
:
p
.
extra_generation_params
[
"Masked content"
]
=
inpainting_fill
if
inpaint_full_res
is
not
None
:
p
.
extra_generation_params
[
"Inpaint area"
]
=
inpaint_full_res
if
inpaint_full_res_padding
is
not
None
:
p
.
extra_generation_params
[
"Only masked padding, pixels"
]
=
inpaint_full_res_padding
with
closing
(
p
):
with
closing
(
p
):
if
is_batch
:
if
is_batch
:
assert
not
shared
.
cmd_opts
.
hide_ui_dir_config
,
"Launched with --hide-ui-dir-config, batch img2img disabled"
assert
not
shared
.
cmd_opts
.
hide_ui_dir_config
,
"Launched with --hide-ui-dir-config, batch img2img disabled"
...
...
modules/infotext_utils.py
View file @
80873b15
...
@@ -312,6 +312,18 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
...
@@ -312,6 +312,18 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
if
"Hires negative prompt"
not
in
res
:
if
"Hires negative prompt"
not
in
res
:
res
[
"Hires negative prompt"
]
=
""
res
[
"Hires negative prompt"
]
=
""
if
"Mask mode"
not
in
res
:
res
[
"Mask mode"
]
=
"Inpaint masked"
if
"Masked content"
not
in
res
:
res
[
"Masked content"
]
=
'original'
if
"Inpaint area"
not
in
res
:
res
[
"Inpaint area"
]
=
"Whole picture"
if
"Masked area padding"
not
in
res
:
res
[
"Masked area padding"
]
=
32
restore_old_hires_fix_params
(
res
)
restore_old_hires_fix_params
(
res
)
# Missing RNG means the default was set, which is GPU RNG
# Missing RNG means the default was set, which is GPU RNG
...
...
modules/processing.py
View file @
80873b15
...
@@ -1530,6 +1530,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1530,6 +1530,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
if
self
.
inpainting_mask_invert
:
if
self
.
inpainting_mask_invert
:
image_mask
=
ImageOps
.
invert
(
image_mask
)
image_mask
=
ImageOps
.
invert
(
image_mask
)
self
.
extra_generation_params
[
"Mask mode"
]
=
"Inpaint not masked"
if
self
.
mask_blur_x
>
0
:
if
self
.
mask_blur_x
>
0
:
np_mask
=
np
.
array
(
image_mask
)
np_mask
=
np
.
array
(
image_mask
)
...
@@ -1543,6 +1544,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1543,6 +1544,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
np_mask
=
cv2
.
GaussianBlur
(
np_mask
,
(
1
,
kernel_size
),
self
.
mask_blur_y
)
np_mask
=
cv2
.
GaussianBlur
(
np_mask
,
(
1
,
kernel_size
),
self
.
mask_blur_y
)
image_mask
=
Image
.
fromarray
(
np_mask
)
image_mask
=
Image
.
fromarray
(
np_mask
)
if
self
.
mask_blur_x
>
0
or
self
.
mask_blur_y
>
0
:
self
.
extra_generation_params
[
"Mask blur"
]
=
self
.
mask_blur
if
self
.
inpaint_full_res
:
if
self
.
inpaint_full_res
:
self
.
mask_for_overlay
=
image_mask
self
.
mask_for_overlay
=
image_mask
mask
=
image_mask
.
convert
(
'L'
)
mask
=
image_mask
.
convert
(
'L'
)
...
@@ -1553,6 +1557,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1553,6 +1557,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
mask
=
mask
.
crop
(
crop_region
)
mask
=
mask
.
crop
(
crop_region
)
image_mask
=
images
.
resize_image
(
2
,
mask
,
self
.
width
,
self
.
height
)
image_mask
=
images
.
resize_image
(
2
,
mask
,
self
.
width
,
self
.
height
)
self
.
paste_to
=
(
x1
,
y1
,
x2
-
x1
,
y2
-
y1
)
self
.
paste_to
=
(
x1
,
y1
,
x2
-
x1
,
y2
-
y1
)
self
.
extra_generation_params
[
"Inpaint area"
]
=
"Only masked"
self
.
extra_generation_params
[
"Masked area padding"
]
=
self
.
inpaint_full_res_padding
else
:
else
:
image_mask
=
images
.
resize_image
(
self
.
resize_mode
,
image_mask
,
self
.
width
,
self
.
height
)
image_mask
=
images
.
resize_image
(
self
.
resize_mode
,
image_mask
,
self
.
width
,
self
.
height
)
np_mask
=
np
.
array
(
image_mask
)
np_mask
=
np
.
array
(
image_mask
)
...
@@ -1594,6 +1601,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1594,6 +1601,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
if
self
.
inpainting_fill
!=
1
:
if
self
.
inpainting_fill
!=
1
:
image
=
masking
.
fill
(
image
,
latent_mask
)
image
=
masking
.
fill
(
image
,
latent_mask
)
if
self
.
inpainting_fill
==
0
:
self
.
extra_generation_params
[
"Masked content"
]
=
'fill'
if
add_color_corrections
:
if
add_color_corrections
:
self
.
color_corrections
.
append
(
setup_color_correction
(
image
))
self
.
color_corrections
.
append
(
setup_color_correction
(
image
))
...
@@ -1643,8 +1653,11 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1643,8 +1653,11 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
# this needs to be fixed to be done in sample() using actual seeds for batches
# this needs to be fixed to be done in sample() using actual seeds for batches
if
self
.
inpainting_fill
==
2
:
if
self
.
inpainting_fill
==
2
:
self
.
init_latent
=
self
.
init_latent
*
self
.
mask
+
create_random_tensors
(
self
.
init_latent
.
shape
[
1
:],
all_seeds
[
0
:
self
.
init_latent
.
shape
[
0
]])
*
self
.
nmask
self
.
init_latent
=
self
.
init_latent
*
self
.
mask
+
create_random_tensors
(
self
.
init_latent
.
shape
[
1
:],
all_seeds
[
0
:
self
.
init_latent
.
shape
[
0
]])
*
self
.
nmask
self
.
extra_generation_params
[
"Masked content"
]
=
'latent noise'
elif
self
.
inpainting_fill
==
3
:
elif
self
.
inpainting_fill
==
3
:
self
.
init_latent
=
self
.
init_latent
*
self
.
mask
self
.
init_latent
=
self
.
init_latent
*
self
.
mask
self
.
extra_generation_params
[
"Masked content"
]
=
'latent nothing'
self
.
image_conditioning
=
self
.
img2img_image_conditioning
(
image
*
2
-
1
,
self
.
init_latent
,
image_mask
,
self
.
mask_round
)
self
.
image_conditioning
=
self
.
img2img_image_conditioning
(
image
*
2
-
1
,
self
.
init_latent
,
image_mask
,
self
.
mask_round
)
...
...
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