Extensions/Kongshan Nodes
ComfyUI Extension

Kongshan Nodes

Kongshan product-image workflow nodes for ComfyUI, including Gemini, CLI, SAM, GroundingDINO, file IO, and local image utilities.

By kongshan4219·Created 3 months ago·Updated 3 months ago· 0
kongshan4219/ComfyUI-Kongshan-Nodes
Nodes19
On cloudLocal install
CategoryKongshan/API, Kongshan/CLI
Stars0
Updated3 months ago

Nodes (19)

分析商品图

It Reads Your Product Photo So the Rest of the Pipeline Can Talk About It

Kongshan/API
Antigravity CLI 命令执行

Run Google's Antigravity (or Any CLI) From Inside Your Graph

Kongshan/CLI
遮罩生成背景图

Give It a Mask, Get White or Transparent Background — Same Composition

Kongshan/Local/Image
CLI 图片输入转临时文件

Turn a ComfyUI Image Into a CLI-Ready Prompt + Paths

Kongshan/CLI
CLI 输出文件转图片

Find the Image Your CLI Agent Just Wrote, and Load It Back

Kongshan/CLI
生成设计策略

The Art-Director Node That Writes Your Final Prompt for You

Kongshan/API
保存图片到自定义目录

Save a Batch Straight to Any Folder You Choose (or Next to the Source)

Kongshan/Local
Draw Size Chart Arrows

Draw the Size-Chart Dimension Lines Right on Your Product Photo

Kongshan/Local
KS API 生图

The Node That Hands Your Product Photo to a Cloud Image Model

Kongshan/API
GroundingDINO + SAM 分割

Text Prompt Straight to Object Masks — One Node, No Wiring

Kongshan/Local
GroundingDINO 检测框

Find 'the Product' by Name and Get Its Bounding Boxes

Kongshan/Local
加载 GroundingDINO 模型

Load GroundingDINO by Name, Weights Land in models/grounding-dino

Kongshan/Local
反转遮罩

Flip a Mask So Background Becomes Foreground — Exactly One Number

Kongshan/Local
检查空遮罩

Tell Me if This Mask Found Anything — as a Number Your Logic Nodes Can Use

Kongshan/Local
从原始路径加载图片

Load an Image From Any Real Path and Keep the Path — Not Just input/

Kongshan/Local
实例商品裁切为背景图

Crop, Center, and Square Up Every Product Onto White

Kongshan/Local/Product
加载 SAM 模型

Load a SAM or SAM-HQ Model From a Dropdown, Weights Auto-Downloaded

Kongshan/Local
SAM 按框分割

Turn Detection Boxes Into Clean Per-Object Masks With SAM

Kongshan/Local
选择参考图

Pick Your Style Reference by Similarity, or Just Wrap One You Already Have

Kongshan/API
Readme

Kongshan Nodes

Kongshan Nodes is a ComfyUI custom-node package extracted from kongshan_comfyui_workspace. It provides nodes for product-image workflows, including Gemini/OpenRouter generation, local file IO, CLI execution, SAM, SAM-HQ, GroundingDINO, mask utilities, white/transparent background composition, and directory-based image saving.

Install

Install from ComfyUI Manager by adding this repository as a custom node source:

https://github.com/kongshan4219/ComfyUI-Kongshan-Nodes.git

After the package is published to Comfy Registry, it can also be installed by node id:

comfy node install kongshan-nodes

Project Structure

This repository follows the current ComfyUI custom-node scaffold layout:

ComfyUI-Kongshan-Nodes/
├── __init__.py                  # ComfyUI custom_nodes entrypoint
├── pyproject.toml               # Registry and Python package metadata
├── src/py/                      # Python package loaded by the ComfyUI entrypoint
│   ├── api/                     # API-backed nodes and their HTTP route helpers
│   ├── cli/                     # CLI-backed nodes and their file IO helpers
│   └── local/                   # Local nodes plus bundled SAM-HQ/GroundingDINO code
└── web/                         # ComfyUI frontend extensions

Workflow files are intentionally not included in this repository. It is published as a node-only registry package.

Registry Metadata

This repository includes pyproject.toml metadata required by Comfy Registry and ComfyUI Manager:

[project]
name = "kongshan-nodes"

[tool.comfy]
PublisherId = "kongshan4219"
DisplayName = "Kongshan Nodes"

Before publishing, confirm that PublisherId matches the publisher id created on Comfy Registry.

Manual publishing:

comfy node publish

Automated publishing:

  1. Create a Comfy Registry access token.
  2. Add it to this GitHub repository as an Actions secret named REGISTRY_ACCESS_TOKEN.
  3. Run the Publish ComfyUI Node workflow manually, or push a version tag such as v0.1.0.

Local Configuration

Copy .env.example to .env and fill local keys as needed:

OPENROUTER_API_KEY=
OPENCODE_API_KEY=
Gemini_API_KEY_FREE=
GEMINI_API_KEY=

Never commit .env.

Local File Pickers

The local image and directory nodes include UI buttons for selecting real filesystem paths:

  • 从原始路径加载图片 opens a backend system file dialog and keeps the selected real filesystem path.
  • 保存图片到自定义目录 opens a system directory picker for the output folder.

Image loading follows ComfyUI's built-in LoadImage behavior for EXIF orientation, animated image frames, alpha masks, output dtype, and output device placement, while still returning the original filesystem path for downstream nodes.

The input-image picker uses the backend system file dialog because browser file inputs cannot expose absolute local paths. On Windows it opens the native Explorer-style file dialog through Python ctypes; on Fedora/Linux it uses zenity or kdialog.

The output-directory picker asks the backend to choose a real filesystem folder through the same operating-system-specific backend.

Fedora/Linux picker dependency checks and install commands:

Fedora Linux:

sudo dnf install -y zenity
# or
sudo dnf install -y kdialog

No extra package is required on Windows.

Included Node Groups

  • Kongshan/API: product analysis, reference selection, design strategy, and Gemini/OpenRouter image generation.
  • Kongshan/CLI: single-command Agent execution, including Antigravity/Codex style command runners.
  • Kongshan/Local: local image loading, directory IO, SAM/GroundingDINO segmentation, masks, product crops, white/transparent background composition, and size-chart arrow drawing.