feat: 为水印与 FeyNobg 抠图节点补充示例工作流

example_workflow/FeyNobg抠图.json:
- 加载图像 → 抠图 → alpha 预览 / cutout 预览 / 透明 RGBA 保存
- 含 InvertMask 环节:JoinImageWithAlpha 内部会做 1-alpha,
  不先反相会得到前景透明的反效果

example_workflow/满屏文字水印.json:
- 同一张图并联两组参数(常规白色半透明 vs 高密度黄色宽字距)便于对比
- Note 说明八个参数的调法,含密度与字号联动的换算关系

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rui40000
2026-07-29 09:48:03 +08:00
co-authored by Claude Opus 4.8
parent 1bd90c71b6
commit 01a26baea9
2 changed files with 499 additions and 0 deletions
+275
View File
@@ -0,0 +1,275 @@
{
"id": "3a7e5c92-1f4d-4b60-8e2a-9c5d3f7b1e04",
"revision": 0,
"last_node_id": 9,
"last_link_id": 8,
"nodes": [
{
"id": 1,
"type": "LoadImage",
"pos": [-1600, 400],
"size": [300, 330],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"label": "图像",
"name": "IMAGE",
"type": "IMAGE",
"links": [1, 2]
},
{
"label": "遮罩",
"name": "MASK",
"type": "MASK",
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "LoadImage"
},
"widgets_values": ["example.png", "image"],
"title": "① 加载原图"
},
{
"id": 2,
"type": "RuiFeyNobg",
"pos": [-1240, 400],
"size": [320, 170],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "alpha",
"type": "MASK",
"links": [3, 4]
},
{
"name": "cutout",
"type": "IMAGE",
"links": [5]
}
],
"properties": {
"aux_id": "rui40000/Ruinode",
"Node name for S&R": "RuiFeyNobg"
},
"widgets_values": ["FeyNobg", 1024, "fp16", "auto", false],
"color": "#232",
"bgcolor": "#353",
"title": "② FeyNobg 抠图(全自动,无需提示)"
},
{
"id": 3,
"type": "MaskPreview",
"pos": [-860, 400],
"size": [280, 300],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"label": "遮罩",
"name": "mask",
"type": "MASK",
"link": 3
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "MaskPreview"
},
"widgets_values": [],
"title": "alpha 遮罩"
},
{
"id": 4,
"type": "InvertMask",
"pos": [-860, 760],
"size": [200, 26],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 4
}
],
"outputs": [
{
"name": "MASK",
"type": "MASK",
"links": [6]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "InvertMask"
},
"widgets_values": [],
"title": "反相(JoinImageWithAlpha 内部会再反一次)"
},
{
"id": 5,
"type": "JoinImageWithAlpha",
"pos": [-860, 840],
"size": [220, 46],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 2
},
{
"name": "alpha",
"type": "MASK",
"link": 6
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [7, 8]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "JoinImageWithAlpha"
},
"widgets_values": [],
"title": "合成透明背景 RGBA"
},
{
"id": 6,
"type": "PreviewImage",
"pos": [-540, 400],
"size": [320, 300],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 5
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "PreviewImage"
},
"widgets_values": [],
"title": "cutout(黑底预览)"
},
{
"id": 7,
"type": "PreviewImage",
"pos": [-540, 760],
"size": [320, 300],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 7
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "PreviewImage"
},
"widgets_values": [],
"color": "#232",
"bgcolor": "#353",
"title": "透明背景成品(RGBA)"
},
{
"id": 8,
"type": "SaveImage",
"pos": [-180, 760],
"size": [320, 300],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 8
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "SaveImage"
},
"widgets_values": ["FeyNobg/cutout"],
"title": "保存透明 PNG"
},
{
"id": 9,
"type": "Note",
"pos": [-1600, 800],
"size": [660, 420],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {},
"widgets_values": [
"FeyNobg 抠图 —— 使用要点\n\n【模型】首次运行会自动下载到 ComfyUI/models/nobg/FeyNobg(约 1.05GB)。\n 也可手动下载 https://huggingface.co/feyninc/FeyNobg 的三个文件放进去:\n config.json / preprocessor_config.json / model.safetensors\n\n【precision】推荐 fp16\n 实测 fp16 与 fp32 输出完全一致(同图 alpha 均值都是 0.657),\n 但 fp16 显存减半、速度快数倍。默认给 fp32 只是为老显卡留退路。\n\n【resolution】保持 1024\n 这是模型原生训练分辨率。降到 768 差别很小(前景占比 0.656 vs 0.659)\n 且更省显存;调高不一定更好,可能出现结构断裂。\n\n【适用范围】画面主体明确时效果最好\n 实测发丝、飘带、细链条等高频细节都能完整分离,边缘是自然的半透明过渡。\n 但它是「找出画面主体」的模型:给一张没有明确主体的图(例如 UI 截图、\n 纯风景),输出接近全黑是正常反应,不是故障。\n\n【与 SDMatte 的分工】\n · FeyNobg:全自动、快,适合批量去背景 —— 主体明确时首选\n · SDMatte:需要框/掩码提示指定目标,适合画面里有多个主体、只抠其中一个\n\n【透明 PNG】cutout 输出是黑底 RGB。要透明背景需走下面这条链路:\n alpha → InvertMask → JoinImageWithAlpha(该节点内部会再反一次,故须先反相)\n\n【invert_mask】节点自带的反转开关只影响 alpha 本身,\n 与上面为 JoinImageWithAlpha 做的反相是两回事,别混用。"
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[1, 1, 0, 2, 0, "IMAGE"],
[2, 1, 0, 5, 0, "IMAGE"],
[3, 2, 0, 3, 0, "MASK"],
[4, 2, 0, 4, 0, "MASK"],
[5, 2, 1, 6, 0, "IMAGE"],
[6, 4, 0, 5, 1, "MASK"],
[7, 5, 0, 7, 0, "IMAGE"],
[8, 5, 0, 8, 0, "IMAGE"]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.8,
"offset": [1800, -300]
}
},
"version": 0.4
}
+224
View File
@@ -0,0 +1,224 @@
{
"id": "b5d81e46-2c93-4a7f-b0e1-6f4a8d2c9b37",
"revision": 0,
"last_node_id": 7,
"last_link_id": 5,
"nodes": [
{
"id": 1,
"type": "LoadImage",
"pos": [-1600, 400],
"size": [300, 330],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"label": "图像",
"name": "IMAGE",
"type": "IMAGE",
"links": [1, 2]
},
{
"label": "遮罩",
"name": "MASK",
"type": "MASK",
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "LoadImage"
},
"widgets_values": ["example.png", "image"],
"title": "① 加载原图"
},
{
"id": 2,
"type": "ImageWatermark",
"pos": [-1240, 400],
"size": [340, 300],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [3, 5]
}
],
"properties": {
"aux_id": "rui40000/Ruinode",
"Node name for S&R": "ImageWatermark"
},
"widgets_values": [
"仅供参考 / SAMPLE\nRuinode",
"微软雅黑 (msyh)",
48,
30,
1,
2,
35,
"#FFFFFF"
],
"color": "#232",
"bgcolor": "#353",
"title": "② 满屏水印(常规:白色半透明)"
},
{
"id": 3,
"type": "ImageWatermark",
"pos": [-1240, 760],
"size": [340, 300],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 2
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [4]
}
],
"properties": {
"aux_id": "rui40000/Ruinode",
"Node name for S&R": "ImageWatermark"
},
"widgets_values": [
"版权所有 © Ruinode",
"微软雅黑 (msyh)",
36,
45,
2.5,
6,
25,
"#FFD400"
],
"title": "③ 对比用:高密度 / 45° / 黄色 / 宽字距"
},
{
"id": 4,
"type": "PreviewImage",
"pos": [-860, 400],
"size": [340, 340],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 3
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "PreviewImage"
},
"widgets_values": [],
"color": "#232",
"bgcolor": "#353",
"title": "常规水印效果"
},
{
"id": 5,
"type": "PreviewImage",
"pos": [-860, 780],
"size": [340, 340],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 4
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "PreviewImage"
},
"widgets_values": [],
"title": "高密度水印效果"
},
{
"id": 6,
"type": "SaveImage",
"pos": [-480, 400],
"size": [340, 340],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 5
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.49",
"Node name for S&R": "SaveImage"
},
"widgets_values": ["watermark/output"],
"title": "保存成品"
},
{
"id": 7,
"type": "Note",
"pos": [-1600, 800],
"size": [660, 430],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {},
"widgets_values": [
"满屏文字水印 —— 八个参数怎么调\n\n【text 文案】支持多行,直接在框里换行即可。\n 多行会作为一个整体单元平铺,行内间距自动按字号的 25% 计算。\n\n【font 字体】列表来自 Ruinode/font 目录(与 Markdown 转图片节点共用)。\n 放入新的 ttf/otf/ttc 后刷新页面即可出现。列表里没有的字体会自动回退,\n 不会报错。\n\n【font_size 文字大小】像素值。它同时是密度的基准(见下)。\n\n【angle 旋转角度】-180~180 度。\n 实现上是「先平铺一张比对角线还大的画布,整体旋转后再从中心裁切」,\n 所以任何角度下四角都不会露白。\n\n【density 密度】0.1~5.0,越大越密。\n 控制的是水印之间的空隙:空隙 = 字号 × 2 ÷ density。\n 因此改字号时密度会跟着等比缩放,视觉疏密保持稳定。\n · 0.4 左右 = 稀疏点缀\n · 1.0 = 默认\n · 2.5 以上 = 密集防盗(建议同时把 opacity 调低到 20~30)\n\n【letter_spacing 字间距】单条文案内相邻字的额外间距,可为负。\n 逐字符绘制实现,负值可以让字挤在一起。\n\n【opacity 透明程度】0 = 完全透明(原样返回,不做任何计算),100 = 不透明。\n 防盗建议 25~40:看得清但不影响读图。\n\n【color 颜色】四种写法都支持:\n #FFFFFF / #FFF / 255,255,255 / white\n 认不出的写法会回退成灰色,不会报错。\n\n【小技巧】深色图用白色 + 35%,浅色图用黑色或深灰 + 25%,\n 彩色图用黄色 (#FFD400) 辨识度最高 —— 上面两个节点就是这个思路的对比。"
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[1, 1, 0, 2, 0, "IMAGE"],
[2, 1, 0, 3, 0, "IMAGE"],
[3, 2, 0, 4, 0, "IMAGE"],
[4, 3, 0, 5, 0, "IMAGE"],
[5, 2, 0, 6, 0, "IMAGE"]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.8,
"offset": [1800, -300]
}
},
"version": 0.4
}