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
97419693
Commit
97419693
authored
Oct 23, 2022
by
Vladimir Repin
Committed by
AUTOMATIC1111
Oct 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save properly processed image before color correction
parent
dd25722d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
modules/processing.py
modules/processing.py
+18
-15
No files found.
modules/processing.py
View file @
97419693
...
...
@@ -46,6 +46,20 @@ def apply_color_correction(correction, image):
return
image
def
apply_overlay
(
overlay_exists
,
overlay
,
paste_loc
,
image
):
if
overlay_exists
:
if
paste_loc
is
not
None
:
x
,
y
,
w
,
h
=
paste_loc
base_image
=
Image
.
new
(
'RGBA'
,
(
overlay
.
width
,
overlay
.
height
))
image
=
images
.
resize_image
(
1
,
image
,
w
,
h
)
base_image
.
paste
(
image
,
(
x
,
y
))
image
=
base_image
image
=
image
.
convert
(
'RGBA'
)
image
.
alpha_composite
(
overlay
)
image
=
image
.
convert
(
'RGB'
)
return
image
def
get_correct_sampler
(
p
):
if
isinstance
(
p
,
modules
.
processing
.
StableDiffusionProcessingTxt2Img
):
...
...
@@ -446,25 +460,14 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
devices
.
torch_gc
()
image
=
Image
.
fromarray
(
x_sample
)
if
p
.
color_corrections
is
not
None
and
i
<
len
(
p
.
color_corrections
):
if
opts
.
save
and
not
p
.
do_not_save_samples
and
opts
.
save_images_before_color_correction
:
images
.
save_image
(
image
,
p
.
outpath_samples
,
""
,
seeds
[
i
],
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
(
n
,
i
),
p
=
p
,
suffix
=
"-before-color-correction"
)
image_without_cc
=
apply_overlay
(
p
.
overlay_images
is
not
None
and
i
<
len
(
p
.
overlay_images
),
p
.
overlay_images
[
i
],
p
.
paste_to
,
image
)
images
.
save_image
(
image_without_cc
,
p
.
outpath_samples
,
""
,
seeds
[
i
],
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
(
n
,
i
),
p
=
p
,
suffix
=
"-before-color-correction"
)
image
=
apply_color_correction
(
p
.
color_corrections
[
i
],
image
)
if
p
.
overlay_images
is
not
None
and
i
<
len
(
p
.
overlay_images
):
overlay
=
p
.
overlay_images
[
i
]
if
p
.
paste_to
is
not
None
:
x
,
y
,
w
,
h
=
p
.
paste_to
base_image
=
Image
.
new
(
'RGBA'
,
(
overlay
.
width
,
overlay
.
height
))
image
=
images
.
resize_image
(
1
,
image
,
w
,
h
)
base_image
.
paste
(
image
,
(
x
,
y
))
image
=
base_image
image
=
image
.
convert
(
'RGBA'
)
image
.
alpha_composite
(
overlay
)
image
=
image
.
convert
(
'RGB'
)
image
=
apply_overlay
(
p
.
overlay_images
is
not
None
and
i
<
len
(
p
.
overlay_images
),
p
.
overlay_images
[
i
],
p
.
paste_to
,
image
)
if
opts
.
samples_save
and
not
p
.
do_not_save_samples
:
images
.
save_image
(
image
,
p
.
outpath_samples
,
""
,
seeds
[
i
],
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
(
n
,
i
),
p
=
p
)
...
...
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