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
b3593d09
Commit
b3593d09
authored
Apr 06, 2023
by
For Sure
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for saving init images in img2img
parent
22bcc7be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
modules/processing.py
modules/processing.py
+8
-0
modules/shared.py
modules/shared.py
+3
-0
No files found.
modules/processing.py
View file @
b3593d09
...
@@ -3,6 +3,7 @@ import math
...
@@ -3,6 +3,7 @@ import math
import
os
import
os
import
sys
import
sys
import
warnings
import
warnings
import
hashlib
import
torch
import
torch
import
numpy
as
np
import
numpy
as
np
...
@@ -476,6 +477,7 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter
...
@@ -476,6 +477,7 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter
"Conditional mask weight"
:
getattr
(
p
,
"inpainting_mask_weight"
,
shared
.
opts
.
inpainting_mask_weight
)
if
p
.
is_using_inpainting_conditioning
else
None
,
"Conditional mask weight"
:
getattr
(
p
,
"inpainting_mask_weight"
,
shared
.
opts
.
inpainting_mask_weight
)
if
p
.
is_using_inpainting_conditioning
else
None
,
"Clip skip"
:
None
if
clip_skip
<=
1
else
clip_skip
,
"Clip skip"
:
None
if
clip_skip
<=
1
else
clip_skip
,
"ENSD"
:
None
if
opts
.
eta_noise_seed_delta
==
0
else
opts
.
eta_noise_seed_delta
,
"ENSD"
:
None
if
opts
.
eta_noise_seed_delta
==
0
else
opts
.
eta_noise_seed_delta
,
"Init image hash"
:
getattr
(
p
,
'init_img_hash'
,
None
)
}
}
generation_params
.
update
(
p
.
extra_generation_params
)
generation_params
.
update
(
p
.
extra_generation_params
)
...
@@ -1007,6 +1009,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1007,6 +1009,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
color_corrections
=
[]
self
.
color_corrections
=
[]
imgs
=
[]
imgs
=
[]
for
img
in
self
.
init_images
:
for
img
in
self
.
init_images
:
# Save init image
if
opts
.
save_init_img
:
self
.
init_img_hash
=
hashlib
.
md5
(
img
.
tobytes
())
.
hexdigest
()
images
.
save_image
(
img
,
path
=
opts
.
outdir_init_images
,
basename
=
None
,
forced_filename
=
self
.
init_img_hash
,
save_to_dirs
=
False
)
image
=
images
.
flatten
(
img
,
opts
.
img2img_background_color
)
image
=
images
.
flatten
(
img
,
opts
.
img2img_background_color
)
if
crop_region
is
None
and
self
.
resize_mode
!=
3
:
if
crop_region
is
None
and
self
.
resize_mode
!=
3
:
...
...
modules/shared.py
View file @
b3593d09
...
@@ -39,6 +39,7 @@ restricted_opts = {
...
@@ -39,6 +39,7 @@ restricted_opts = {
"outdir_grids"
,
"outdir_grids"
,
"outdir_txt2img_grids"
,
"outdir_txt2img_grids"
,
"outdir_save"
,
"outdir_save"
,
"outdir_init_images"
}
}
ui_reorder_categories
=
[
ui_reorder_categories
=
[
...
@@ -253,6 +254,7 @@ options_templates.update(options_section(('saving-images', "Saving images/grids"
...
@@ -253,6 +254,7 @@ options_templates.update(options_section(('saving-images', "Saving images/grids"
"use_upscaler_name_as_suffix"
:
OptionInfo
(
False
,
"Use upscaler name as filename suffix in the extras tab"
),
"use_upscaler_name_as_suffix"
:
OptionInfo
(
False
,
"Use upscaler name as filename suffix in the extras tab"
),
"save_selected_only"
:
OptionInfo
(
True
,
"When using 'Save' button, only save a single selected image"
),
"save_selected_only"
:
OptionInfo
(
True
,
"When using 'Save' button, only save a single selected image"
),
"do_not_add_watermark"
:
OptionInfo
(
False
,
"Do not add watermark to images"
),
"do_not_add_watermark"
:
OptionInfo
(
False
,
"Do not add watermark to images"
),
"save_init_img"
:
OptionInfo
(
True
,
"Save init images when using img2img"
),
"temp_dir"
:
OptionInfo
(
""
,
"Directory for temporary images; leave empty for default"
),
"temp_dir"
:
OptionInfo
(
""
,
"Directory for temporary images; leave empty for default"
),
"clean_temp_dir_at_start"
:
OptionInfo
(
False
,
"Cleanup non-default temporary directory when starting webui"
),
"clean_temp_dir_at_start"
:
OptionInfo
(
False
,
"Cleanup non-default temporary directory when starting webui"
),
...
@@ -268,6 +270,7 @@ options_templates.update(options_section(('saving-paths', "Paths for saving"), {
...
@@ -268,6 +270,7 @@ options_templates.update(options_section(('saving-paths', "Paths for saving"), {
"outdir_txt2img_grids"
:
OptionInfo
(
"outputs/txt2img-grids"
,
'Output directory for txt2img grids'
,
component_args
=
hide_dirs
),
"outdir_txt2img_grids"
:
OptionInfo
(
"outputs/txt2img-grids"
,
'Output directory for txt2img grids'
,
component_args
=
hide_dirs
),
"outdir_img2img_grids"
:
OptionInfo
(
"outputs/img2img-grids"
,
'Output directory for img2img grids'
,
component_args
=
hide_dirs
),
"outdir_img2img_grids"
:
OptionInfo
(
"outputs/img2img-grids"
,
'Output directory for img2img grids'
,
component_args
=
hide_dirs
),
"outdir_save"
:
OptionInfo
(
"log/images"
,
"Directory for saving images using the Save button"
,
component_args
=
hide_dirs
),
"outdir_save"
:
OptionInfo
(
"log/images"
,
"Directory for saving images using the Save button"
,
component_args
=
hide_dirs
),
"outdir_init_images"
:
OptionInfo
(
"outputs/init-images"
,
"Directory for saving init images when using img2img"
,
component_args
=
hide_dirs
),
}))
}))
options_templates
.
update
(
options_section
((
'saving-to-dirs'
,
"Saving to a directory"
),
{
options_templates
.
update
(
options_section
((
'saving-to-dirs'
,
"Saving to a directory"
),
{
...
...
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