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
33c8fe12
Commit
33c8fe12
authored
Feb 19, 2024
by
Andray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid doble upscaling in inpaint
parent
6e4fc5e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
modules/processing.py
modules/processing.py
+6
-9
No files found.
modules/processing.py
View file @
33c8fe12
...
@@ -74,16 +74,18 @@ def uncrop(image, dest_size, paste_loc):
...
@@ -74,16 +74,18 @@ def uncrop(image, dest_size, paste_loc):
def
apply_overlay
(
image
,
paste_loc
,
overlay
):
def
apply_overlay
(
image
,
paste_loc
,
overlay
):
if
overlay
is
None
:
if
overlay
is
None
:
return
image
return
image
,
image
.
copy
()
if
paste_loc
is
not
None
:
if
paste_loc
is
not
None
:
image
=
uncrop
(
image
,
(
overlay
.
width
,
overlay
.
height
),
paste_loc
)
image
=
uncrop
(
image
,
(
overlay
.
width
,
overlay
.
height
),
paste_loc
)
original_denoised_image
=
image
.
copy
()
image
=
image
.
convert
(
'RGBA'
)
image
=
image
.
convert
(
'RGBA'
)
image
.
alpha_composite
(
overlay
)
image
.
alpha_composite
(
overlay
)
image
=
image
.
convert
(
'RGB'
)
image
=
image
.
convert
(
'RGB'
)
return
image
return
image
,
original_denoised_image
def
create_binary_mask
(
image
,
round
=
True
):
def
create_binary_mask
(
image
,
round
=
True
):
if
image
.
mode
==
'RGBA'
and
image
.
getextrema
()[
-
1
]
!=
(
255
,
255
):
if
image
.
mode
==
'RGBA'
and
image
.
getextrema
()[
-
1
]
!=
(
255
,
255
):
...
@@ -1021,7 +1023,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -1021,7 +1023,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
if
p
.
color_corrections
is
not
None
and
i
<
len
(
p
.
color_corrections
):
if
p
.
color_corrections
is
not
None
and
i
<
len
(
p
.
color_corrections
):
if
save_samples
and
opts
.
save_images_before_color_correction
:
if
save_samples
and
opts
.
save_images_before_color_correction
:
image_without_cc
=
apply_overlay
(
image
,
p
.
paste_to
,
overlay_image
)
image_without_cc
,
_
=
apply_overlay
(
image
,
p
.
paste_to
,
overlay_image
)
images
.
save_image
(
image_without_cc
,
p
.
outpath_samples
,
""
,
p
.
seeds
[
i
],
p
.
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
(
i
),
p
=
p
,
suffix
=
"-before-color-correction"
)
images
.
save_image
(
image_without_cc
,
p
.
outpath_samples
,
""
,
p
.
seeds
[
i
],
p
.
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
(
i
),
p
=
p
,
suffix
=
"-before-color-correction"
)
image
=
apply_color_correction
(
p
.
color_corrections
[
i
],
image
)
image
=
apply_color_correction
(
p
.
color_corrections
[
i
],
image
)
...
@@ -1029,12 +1031,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -1029,12 +1031,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
# that is being composited over the original image,
# that is being composited over the original image,
# we need to keep the original image around
# we need to keep the original image around
# and use it in the composite step.
# and use it in the composite step.
original_denoised_image
=
image
.
copy
()
image
,
original_denoised_image
=
apply_overlay
(
image
,
p
.
paste_to
,
overlay_image
)
if
p
.
paste_to
is
not
None
:
original_denoised_image
=
uncrop
(
original_denoised_image
,
(
overlay_image
.
width
,
overlay_image
.
height
),
p
.
paste_to
)
image
=
apply_overlay
(
image
,
p
.
paste_to
,
overlay_image
)
if
p
.
scripts
is
not
None
:
if
p
.
scripts
is
not
None
:
pp
=
scripts
.
PostprocessImageArgs
(
image
)
pp
=
scripts
.
PostprocessImageArgs
(
image
)
...
...
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