工具|智能分层 PSD 生成器
AI-generated image to editable Photoshop layers, automatically
- 输入图片
- PSD文件路径
- 分层日志
- 预览图
The workflow problem this node solves is the one nobody mentions until they've hit it: you generate the perfect e-commerce product shot, and then a human has to open it in Photoshop and manually cut out the product, the text, the price tag, the QR code - an hour of fiddly layer work for every image. Smart PSD Layering automates that. Feed it an image, and it splits the thing into an actual editable, layered .psd you can open in Photoshop 2023+. This is one of the few genuinely local nodes in the Tikpan Pro pack - no API key, no per-call fee, your image never leaves the machine. It's the pack's flagship tool and the README's star feature, and it earns the attention.
How it works
Three quality tiers, each a different pipeline:
- 经济档 - BiRefNet cutout + cv2 connected-components + PaddleOCR. 5–15s, 5–10 layers. Fine for a simple product on a plain background.
- 标准档 (recommended) - BiRefNet + SAM2 automatic multi-scale segmentation + PaddleOCR. 20–60s, 10–20 layers. The default for a reason: it handles most real product shots.
- 极致档 - adds GroundingDINO semantic segmentation and LaMa inpainting. 60–180s, 20–50 layers, with layers named by meaning (
logo,price tag) rather than just "region 4". This is the commercial-grade one.
The stack is all open-source and well-trodden: BiRefNet is the current default recommendation for background removal (background-removal.md), SAM2 does the segmentation, GroundingDINO is the text-prompted detector that finds "the badge" by name, and LaMa fills in what the occluding element covered (masking-detection-detailing.md). There's a degradation chain throughout - BiRefNet falls back to rembg, PaddleOCR to EasyOCR, GroundingDINO to SAM2 dense segmentation - so a missing piece of the stack degrades quality instead of crashing.
The 场景类型 dropdown (auto-detect, product, detail-page/poster, person, lifestyle, all-scenes) switches GroundingDINO's prompt set and enhancement modules: portraits swap in a BiRefNet-Portrait model, posters get text grouped by font size into title/subtitle/body/price buckets, product shots get QR codes isolated into their own layers with the scanned URL baked into the layer name.
Inputs and outputs that matter
输入图片 is the IMAGE input. 文件名 names the output. 分层档位 and 场景类型 are the two choices that shape everything else. 检测文字 (default on) separates text into its own layers - keep it on for posters and ads. 最小元素面积 (default 2000) filters out tiny junk regions; lower it if you're missing small details, raise it if you're drowning in noise. 边缘羽化 feathers layer edges. 自动安装依赖 (default on) handles the first-run install - leave it on.
Outputs: PSD文件路径 (STRING - where the .psd was written, in ComfyUI's output dir), 分层日志 (STRING - what the pipeline found and decided), and 预览图 (IMAGE, a rendered preview so you can eyeball the layering without opening Photoshop).
Installing
Pack install as usual - Manager search "Tikpan", or git clone https://github.com/htrert/ComfyUI-Tikpan-Pro into custom_nodes, restart. The first run auto-installs dependencies and downloads ~2–4GB of models (BiRefNet, SAM2, PaddleOCR, possibly GroundingDINO + LaMa). Use the PSD 模型预下载器 node first to do that on your schedule instead of mid-workflow. Needs a GPU for the standard/premium tiers to hit the advertised speeds.
Common issues
- "SAM2 不可用,降级到 rembg." The node literally tells you when SAM2 failed to install or ran out of VRAM. The fallback still produces a layered PSD, just coarser. Check the log; if it's a VRAM issue, drop to 经济档.
- "缺少依赖" errors. Auto-install was off or failed. Re-run with it on, or pre-download with the dependency downloader.
- Tiny fragments everywhere. That's 最小元素面积 set too low, or 全场景 mode being over-eager. The guide warns 全场景 gives the most layers but also the most false positives - reach for it only when the specific presets disappoint.
- Slow SAM2 downloads. Facebook CDN can be glacial in some regions; grab
sam2.1_hiera_small.ptfrom the SAM2 releases manually and drop it inComfyUI/models/sam2/.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| 输入图片 | IMAGE | 要进行智能分层的图片 | |
| 文件名 | STRING | smart_layered | PSD 文件名 |
| 分层档位 | COMBO | 标准档 - BiRefNet+SAM2 高精度 推荐 | 经济档:BiRefNet+cv2 快速;标准档:BiRefNet+SAM2 高精度;极致档:BiRefNet+GroundingDINO+SAM2+LaMa 商业级 |
| 场景类型 | COMBO | 自动检测(推荐) | 选场景类型,自动切换 GroundingDINO 提示词、人物专用模型、二维码/色块/字号分组等增强。自动检测会先粗识别再判断 |
| 补全被遮挡区域 | COMBO | 否 | 标准档+开启此项 = 极致档效果。补全被其他元素遮挡的部分(速度变慢约2倍) |
| 检测文字 | COMBO | 是 | 是否单独分离文字图层 |
| 最小元素面积 | INT | 2000100–100000 | 过滤小于此面积的元素 |
| 边缘羽化 | INT | 50–30 | 边缘羽化程度 |
| 自动安装依赖 | COMBO | 是 | 首次使用自动安装依赖(推荐) |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| PSD文件路径 | STRING | — |
| 分层日志 | STRING | — |
| 预览图 | IMAGE | — |