Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
C
ComfyUI
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
锁定的文件
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
hanamizuki
ComfyUI
提交
2ec980bb
提交
2ec980bb
编辑于
1 year ago
作者:
comfyanonymous
浏览文件
操作
下载
补丁
差异文件
Limit preview to webp and RGB jpeg.
上级
9f3a19b7
No related branches found
No related tags found
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
server.py
+6
-7
6 个添加, 7 个删除
server.py
web/scripts/ui.js
+2
-3
2 个添加, 3 个删除
web/scripts/ui.js
有
8 个添加
和
10 个删除
server.py
+
6
−
7
浏览文件 @
2ec980bb
...
...
@@ -221,19 +221,18 @@ class PromptServer():
with
Image
.
open
(
file
)
as
img
:
preview_info
=
request
.
rel_url
.
query
[
'
preview
'
].
split
(
'
;
'
)
if
preview_info
[
0
]
==
"
L
"
or
preview_info
[
0
]
==
"
l
"
:
img
=
img
.
convert
(
"
L
"
)
image_format
=
preview_info
[
1
]
else
:
img
=
img
.
convert
(
"
RGB
"
)
# jpeg doesn't support RGBA
image_format
=
preview_info
[
0
]
image_format
=
preview_info
[
0
]
if
image_format
not
in
[
'
webp
'
,
'
jpeg
'
]:
image_format
=
'
webp
'
quality
=
90
if
preview_info
[
-
1
].
isdigit
():
quality
=
int
(
preview_info
[
-
1
])
buffer
=
BytesIO
()
img
.
save
(
buffer
,
format
=
image_format
,
optimize
=
True
,
quality
=
quality
)
if
image_format
in
[
'
jpeg
'
]:
img
=
img
.
convert
(
"
RGB
"
)
img
.
save
(
buffer
,
format
=
image_format
,
quality
=
quality
)
buffer
.
seek
(
0
)
return
web
.
Response
(
body
=
buffer
.
read
(),
content_type
=
f
'
image/
{
image_format
}
'
,
...
...
此差异已折叠。
点击以展开。
web/scripts/ui.js
+
2
−
3
浏览文件 @
2ec980bb
...
...
@@ -465,12 +465,11 @@ export class ComfyUI {
/**
* file format for preview
*
*
L?;
format;quality
* format;quality
*
* ex)
*
L;
webp;50 ->
grayscale,
webp, quality 50
* webp;50 -> webp, quality 50
* jpeg;80 -> rgb, jpeg, quality 80
* png -> rgb, png, default quality(=90)
*
* @type {string}
*/
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录