Community图像github.com

fxai666/fxai-comfyui-image-gen

本地 ComfyUI 文生图能力(千问2.1 模板,原生中文提示词)。当用户要求在对话里生成图片、配图、画一张图、出张图、做封面图、用中文提示词生图、给文章/视频/设计配视觉素材时使用。生成的是用户自有角色形象的图(参考图 000 女 / 001 男,规避他人肖像侵权),产物经 HTTP 下载到本地并返回 PNG 路径。仅依赖 ComfyUI HTTP 服务(由 comfy_url 指定,本地或远端均可),提交/探测/下载全部经 HTTP 接口完成,绝不读取 ComfyUI 本机目录;无常驻进程。 # std:allow

fxai-comfyui-image-gen 是什么?

fxai-comfyui-image-gen is a Claude Code agent skill that 本地 ComfyUI 文生图能力(千问2.1 模板,原生中文提示词)。当用户要求在对话里生成图片、配图、画一张图、出张图、做封面图、用中文提示词生图、给文章/视频/设计配视觉素材时使用。生成的是用户自有角色形象的图(参考图 000 女 / 001 男,规避他人肖像侵权),产物经 HTTP 下载到本地并返回 PNG 路径。仅依赖 ComfyUI HTTP 服务(由 comfy_url 指定,本地或远端均可),提交/探测/下载全部经 HTTP 接口完成,绝不读取 ComfyUI 本机目录;无常驻进程。 # std:allow.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/fxai666/fxai-fully-automated-creation-skills/tree/HEAD/skills/fxai-comfyui-image-gen

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Local ComfyUI Image Generation (Chinese Prompts)

Skill File Index (Read This First to Decide Which Sections to Read)

FileWhen to Read
SKILL.mdThis file: prerequisites / local-first / cloud startup/shutdown / three calling methods / parameters / long-term conventions / waiting for results
image_gen.pyImplementation of generate_image(); call according to SKILL.md, read the corresponding function only when modifying behaviour
feed_screen.pyVideo information feed (UI template): spec → six-section skeleton prompt → submit
references/01-Environment&Routing.mdCheck prerequisites, local-first routing, automatic cloud startup/shutdown before starting work
references/02-Calling&Parameters.mdHow to call generate_image, parameter defaults, output location
references/03-OutfitValidationDetails.mdWhen character images are blocked by ValueError, check validation keywords and release conditions
references/04-BatchResultDetails.mdWhen generating multiple images at once, check two waiting methods and the "screen not moving ≠ stuck" criterion
references/05-LongTermConventions.mdCheck red-line criteria before writing prompts, before passing reference images, or when encountering outfit validation or <imageN> errors
references/06-VideoInformationFeed.mdWhen creating video information feed UI templates (play page / live page / note detail / product detail, including status bar / navigation bar / interaction counts / bottom navigation), check segment order, UI five-zone structure, size table, and acceptance items

Submit "Chinese prompts" to the locally deployed ComfyUI (Qwen2.1 image processing workflow), generate PNG, and return a local path. The core logic is in image_gen.py: generate_image only does parameter mapping; the actual "placeholder workflow submission → polling → HTTP download" is handled by the shared client fxai-workflow/comfy_client.py (shared with fxai-scene-gen / fxai-fourview-gen / fxai-mv-pipeline). All use the placeholder pattern (fxai_xxx placeholders injected by comfy_client).

🚨 Pre-Work Checklist (Read Before Starting)

  1. 🔴 First step: read fxai-workflow/SKILL.md section "🚨 ComfyUI Server Mode Irreducible Rules" — the irreducible rules are in the dependency's SKILL.md, not in comfy_client.py (reading only the function will miss them). Core: ComfyUI is started/stopped by "Fengxi Local AI Console"/launcher; this skill only sends HTTP by address; if port 8188 is unreachable → use cloud or prompt user to start; resource availability is determined solely by the server API.

🔴 Font Licensing Gate (Read Before Rendering Text)

🔴 If any text appears in the output (covers/illustrations), you must first read fxai-standard/references/06-Font&AssetLicensing.md before rendering: fonts must be chosen only from the white list in section 06 (prefer Noto Sans SC / OFL on local; Microsoft YaHei bundled with Windows is also allowed). Commercial font libraries such as Huawen are prohibited. Record the font name and license when delivering.

Prerequisites

The remaining four prerequisites are in references/01-Environment&Routing.md.

🔴 Local First, Then Xiān Gōng Yún (Cloud)

Routing details and cloud startup/shutdown are in references/01-Environment&Routing.md.

Xiān Gōng Yún: Auto-Boot + Auto-Shutdown After Work

Three Calling Methods

Method A: Direct Import (Preferred for In-Conversation Scripts)

See reference 02.

Method B: CLI (Run Directly in Bash; Must Allow Sandbox Network to Reach ComfyUI)

See reference 02.

Method C: Video Information Feed (UI Template)

python feed_screen.py <spec.json> --tag <project>_<interface> --save-dir <project_directory>
python feed_screen.py <spec.json> --print-only   # only view the composed prompt

Segment order, UI five-zone structure, size table, and acceptance items: see references/06-VideoInformationFeed.md.

Parameters (generate_image)

Long-Term Conventions (Must Follow; Details in references/05-LongTermConventions.md)

  1. 🔴 Reference images: Characters must always use the own role images 000/001 (role=woman/man/both or a custom relative path); covers / posters must use that work's own character image, not the global avatar library avatar/000, 001.
  2. 🔴 Prompts: Chinese directly to image, no English needed; if a person appears in the scene, you must write [outfit/clothing] + [head shape/hairstyle]; check_outfit() enforces a hard validation.
  3. 🔴 Multiple reference images: For N images, you must write <imageN> for each; missing one triggers ValueError (check_image_refs()); numbering = order of reference images, male character first.
  4. Attire red line: Chest / private areas must remain covered; aim for "sheer but not exposed."
  5. Output validation: After HTTP download, png_ok checks for the IEND chunk; if incomplete, retry. This skill only generates images; publishing is handled by fxai-weixin-gzh-publisher.

Output Directory

Output location: see references/02-Calling&Parameters.md.

Waiting for Results: Global Broadcast Listener (Built-in)

generate_image internally calls comfy_client.submit_workflow. After submission, it waits via broadcast listener: After queued <pid> in the log, real-time progress updates appear line by line; once complete, it automatically fetches the URL and downloads the image, returning a local path — Use this broadcast link to wait for results (calling sleep + polling /history or /fxai/tasks/result will yield duplicate states). While waiting for GPU in the queue, the listener checks /queue to confirm "still in queue" and continues waiting. Manual check: comfy_watch.py status <pid_prefix> / comfy_watch.py top (skill fxai-comfyui-watcher).

🔴 How to Wait for Batch Generation

Once you receive "still running / will be notified automatically," stop querying immediately; use block=true only when remaining time ≤ 60 seconds. Three task_id states and the "screen not moving ≠ stuck" criterion: see references/04-BatchResultDetails.md.

Validation

After modifying image_gen.py, run: python image_gen.py "test, pure scene landscape" --role "" --tag smoke_test, Confirm it returns a valid PNG path and the file is intact (>100 bytes, contains IEND).

Once you have determined what to do, read only the corresponding one or two reference files; skip the rest.

Project List (Page Shows Progress Accordingly)

Create the output directory and record the project; update after each completed segment; structure: see fxai-standard reference 01.

P=~/.workbuddy/skills/fxai-standard/scripts/fxai_project.py
python "$P" init  "<project>" --title <name> --category image --skill fxai-comfyui-image-gen
python "$P" stage "<project>" --script 2 --image 1 --audio 0 --video 0

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相关技能