Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
06186582
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
11 个月 前同步成功
通知
1758
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
06186582
编写于
9月 21, 2022
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
prevent outpainting mk2 from breaking on different image resolutions.
上级
1ebb5cc6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
7 deletion
+14
-7
scripts/outpainting_mk_2.py
scripts/outpainting_mk_2.py
+14
-7
未找到文件。
scripts/outpainting_mk_2.py
浏览文件 @
06186582
...
...
@@ -197,6 +197,7 @@ class Script(scripts.Script):
if
left
>
0
:
left
=
left
*
(
target_w
-
init_img
.
width
)
//
(
left
+
right
)
if
right
>
0
:
right
=
target_w
-
init_img
.
width
-
left
...
...
@@ -208,7 +209,7 @@ class Script(scripts.Script):
init_image
=
p
.
init_images
[
0
]
state
.
job_count
=
(
1
if
left
>
0
else
0
)
+
(
1
if
right
>
0
else
0
)
+
(
1
if
up
>
0
else
0
)
+
(
1
if
down
>
0
else
0
)
state
.
job_count
=
(
1
if
left
>
0
else
0
)
+
(
1
if
right
>
0
else
0
)
+
(
1
if
up
>
0
else
0
)
+
(
1
if
down
>
0
else
0
)
def
expand
(
init
,
expand_pixels
,
is_left
=
False
,
is_right
=
False
,
is_top
=
False
,
is_bottom
=
False
):
is_horiz
=
is_left
or
is_right
...
...
@@ -216,15 +217,20 @@ class Script(scripts.Script):
pixels_horiz
=
expand_pixels
if
is_horiz
else
0
pixels_vert
=
expand_pixels
if
is_vert
else
0
img
=
Image
.
new
(
"RGB"
,
(
init
.
width
+
pixels_horiz
,
init
.
height
+
pixels_vert
))
res_w
=
init
.
width
+
pixels_horiz
res_h
=
init
.
height
+
pixels_vert
process_res_w
=
math
.
ceil
(
res_w
/
64
)
*
64
process_res_h
=
math
.
ceil
(
res_h
/
64
)
*
64
img
=
Image
.
new
(
"RGB"
,
(
process_res_w
,
process_res_h
))
img
.
paste
(
init
,
(
pixels_horiz
if
is_left
else
0
,
pixels_vert
if
is_top
else
0
))
mask
=
Image
.
new
(
"RGB"
,
(
init
.
width
+
pixels_horiz
,
init
.
height
+
pixels_vert
),
"white"
)
mask
=
Image
.
new
(
"RGB"
,
(
process_res_w
,
process_res_h
),
"white"
)
draw
=
ImageDraw
.
Draw
(
mask
)
draw
.
rectangle
((
expand_pixels
+
mask_blur
if
is_left
else
0
,
expand_pixels
+
mask_blur
if
is_top
else
0
,
mask
.
width
-
expand_pixels
-
mask_blur
if
is_right
else
mask
.
width
,
mask
.
height
-
expand_pixels
-
mask_blur
if
is_bottom
else
mask
.
height
,
mask
.
width
-
expand_pixels
-
mask_blur
if
is_right
else
res_w
,
mask
.
height
-
expand_pixels
-
mask_blur
if
is_bottom
else
res_h
,
),
fill
=
"black"
)
np_image
=
(
np
.
asarray
(
img
)
/
255.0
).
astype
(
np
.
float64
)
...
...
@@ -255,8 +261,8 @@ class Script(scripts.Script):
draw
.
rectangle
((
expand_pixels
+
mask_blur
*
2
if
is_left
else
0
,
expand_pixels
+
mask_blur
*
2
if
is_top
else
0
,
mask
.
width
-
expand_pixels
-
mask_blur
*
2
if
is_right
else
mask
.
width
,
mask
.
height
-
expand_pixels
-
mask_blur
*
2
if
is_bottom
else
mask
.
height
,
mask
.
width
-
expand_pixels
-
mask_blur
*
2
if
is_right
else
res_w
,
mask
.
height
-
expand_pixels
-
mask_blur
*
2
if
is_bottom
else
res_h
,
),
fill
=
"black"
)
p
.
latent_mask
=
latent_mask
...
...
@@ -268,6 +274,7 @@ class Script(scripts.Script):
initial_seed_and_info
[
1
]
=
proc
.
info
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
))
return
out
img
=
init_image
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录