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
18df060c
Commit
18df060c
authored
Oct 20, 2022
by
wywywywy
Committed by
GitHub
Oct 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed outpainting_mk2 output cropping
parent
91efe138
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
scripts/outpainting_mk_2.py
scripts/outpainting_mk_2.py
+11
-10
No files found.
scripts/outpainting_mk_2.py
View file @
18df060c
...
...
@@ -183,6 +183,7 @@ class Script(scripts.Script):
pixels_vert
=
expand_pixels
if
is_vert
else
0
images_to_process
=
[]
output_images
=
[]
for
n
in
range
(
count
):
res_w
=
init
[
n
]
.
width
+
pixels_horiz
res_h
=
init
[
n
]
.
height
+
pixels_vert
...
...
@@ -203,7 +204,7 @@ class Script(scripts.Script):
np_image
=
(
np
.
asarray
(
img
)
/
255.0
)
.
astype
(
np
.
float64
)
np_mask
=
(
np
.
asarray
(
mask
)
/
255.0
)
.
astype
(
np
.
float64
)
noised
=
get_matched_noise
(
np_image
,
np_mask
,
noise_q
,
color_variation
)
out
=
Image
.
fromarray
(
np
.
clip
(
noised
*
255.
,
0.
,
255.
)
.
astype
(
np
.
uint8
),
mode
=
"RGB"
)
out
put_images
.
append
(
Image
.
fromarray
(
np
.
clip
(
noised
*
255.
,
0.
,
255.
)
.
astype
(
np
.
uint8
),
mode
=
"RGB"
)
)
target_width
=
min
(
process_width
,
init
[
n
]
.
width
+
pixels_horiz
)
if
is_horiz
else
img
.
width
target_height
=
min
(
process_height
,
init
[
n
]
.
height
+
pixels_vert
)
if
is_vert
else
img
.
height
...
...
@@ -211,15 +212,15 @@ class Script(scripts.Script):
p
.
height
=
target_height
if
is_vert
else
img
.
height
crop_region
=
(
0
if
is_left
else
out
.
width
-
target_width
,
0
if
is_top
else
out
.
height
-
target_height
,
target_width
if
is_left
else
out
.
width
,
target_height
if
is_top
else
out
.
height
,
0
if
is_left
else
out
put_images
[
n
]
.
width
-
target_width
,
0
if
is_top
else
out
put_images
[
n
]
.
height
-
target_height
,
target_width
if
is_left
else
out
put_images
[
n
]
.
width
,
target_height
if
is_top
else
out
put_images
[
n
]
.
height
,
)
mask
=
mask
.
crop
(
crop_region
)
p
.
image_mask
=
mask
image_to_process
=
out
.
crop
(
crop_region
)
image_to_process
=
out
put_images
[
n
]
.
crop
(
crop_region
)
images_to_process
.
append
(
image_to_process
)
p
.
init_images
=
images_to_process
...
...
@@ -240,11 +241,11 @@ class Script(scripts.Script):
initial_seed_and_info
[
0
]
=
proc
.
seed
initial_seed_and_info
[
1
]
=
proc
.
info
for
proc_img
in
proc
.
images
:
out
.
paste
(
proc_img
,
(
0
if
is_left
else
out
.
width
-
proc_img
.
width
,
0
if
is_top
else
out
.
height
-
proc_img
.
height
))
out
=
out
.
crop
((
0
,
0
,
res_w
,
res_h
))
for
n
in
range
(
count
)
:
out
put_images
[
n
]
.
paste
(
proc
.
images
[
n
],
(
0
if
is_left
else
output_images
[
n
]
.
width
-
proc
.
images
[
n
]
.
width
,
0
if
is_top
else
output_images
[
n
]
.
height
-
proc
.
images
[
n
]
.
height
))
out
put_images
[
n
]
=
output_images
[
n
]
.
crop
((
0
,
0
,
res_w
,
res_h
))
return
proc
.
images
return
output_
images
batch_count
=
p
.
n_iter
batch_size
=
p
.
batch_size
...
...
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