Nodes/Comfyui-WL-MainImageDesign/🎨 WL Main Image Designer
ComfyUI Node

🎨 WL Main Image Designer

The node that writes your shop-ad prompts — API key required

By senhaicc·Created 8 months ago·Updated 8 months ago· 0
🎨 WL Main Image Designer
  • product_image
  • product_image_2
  • product_image_3
  • product_image_4
  • prompts_list
  • debug_info
api_urlhttps://api.openai.com/v1
api_key
model_namegemini-2.0-flash-exp
product_type摩托车头盔
selling_points碳纤维材质、轻量化设计、风噪降低
design_style专业机能风
scene_mode场景融合(产品+使用情境)
aspect_ratio1:1 正方形 (800x800)
price_display大促价格块 (¥XX + 划线原价)
price_value¥299
original_price¥599
promo_typeTOP排名徽章 (热销第1名)
trust_bar顺丰包邮|三年质保|7天无理由
output_language中文 (Chinese)
seed0
prompt_count3

The name is a small lie. WL Main Image Designer doesn't design a main image - it designs the prompt for one. You feed it a product description, maybe a photo of the product, and it calls an LLM over the network to write ready-to-paste image prompts in Chinese or English. It's the rare ComfyUI node whose hardest dependency is an API key, not a 6GB safetensors file.

It comes from a Chinese e-commerce seller's toolkit (the README calls it a "TDGO custom edition," and the contact info is a WeChat ID, so yes, this is a real shop's internal tool gone open source), and it's obsessively specialized: motorcycle helmets, riding suits, gloves, armor. Nine design styles - 专业机能风 (functional), 硬核竞技风 (racing), 高端质感风 (premium), 参数对比风 (spec comparison), and six more - plus three scene modes, price/promo/trust-bar placement, and strict 1:1 or 3:4 layout blueprints. If you sell anything on a Chinese marketplace and keep fighting the blank white background, this is aimed squarely at you.

How it works

The node is a thin OpenAI-compatible client with a very long prompt behind it. It loads a system prompt from prompts/system_prompt.txt inside the pack, builds a user prompt from your inputs, and POSTs it to a /chat/completions endpoint using Python's standard library - no requests, no external deps beyond the PIL/numpy ComfyUI already ships. The model is told to reply with a JSON array of complete prompts, each one a structured block: 主标题 (headline), 副标题 (subheadline), 价格促销区 (price/promo), 排版蓝图 (layout blueprint), 视觉与光影 (visuals & lighting), 渲染品质 (render quality).

A few mechanism details worth knowing before you blame it for weird output:

  • Up to four product_image inputs get downscaled to 1024px JPEG and base64-embedded as a vision call. The instructions say the reference photos only lock the product's appearance - the scene gets rebuilt fresh. So your photo background is deliberately ignored.
  • It parses the JSON response, and if the count is short it makes follow-up calls - up to five API calls total - asking for the remaining variants. If it still can't reach your prompt_count, it pads the output with [GENERATION_FAILED] strings.
  • A seed is only sent to the API if it's greater than 0. Keep it at 0 and you get full-temperature (0.75) variety; set it to pin things down.

The inputs that actually matter

Most of the 16 fields are self-explanatory dropdowns, but three are where people get burned:

  • api_url / api_key / model_name - the API trio. The default is https://api.openai.com/v1 with model gemini-2.0-flash-exp. That combination only works if your URL points at an OpenAI-compatible gateway (Google's own Gemini endpoint, a proxy, an Ollama-style server), because that model name isn't served by the real OpenAI API. If your first run returns [GENERATION_FAILED], this is the first place to look.
  • product_type + selling_points - free text. Be specific: "碳纤维材质、轻量化设计、风噪降低" beats "good helmet." This is what the LLM actually has to work with.
  • output_language - Chinese by default. Flip it to English if you're generating for a non-Chinese storefront; it switches the module headers and all the anti-gibberish text rules.

The rest - design_style, scene_mode, aspect_ratio, price_display/price_value/original_price, promo_type, trust_bar, prompt_count (1–10) - are pick-and-choose. Set them once and forget.

Wiring the outputs

Two outputs: prompts_list (a list of strings - the actual prompts) and debug_info (a JSON blob showing what calls were attempted and any API error). Connect prompts_list to a text display or save node, or pick one and route it into your image generator's prompt input (CLIP Text Encode for an SDXL/Flux checkpoint). The prompts are written as structured instructions, which suits Flux-lineage models - the modern LLM-encoded checkpoints - better than classic tag bags. One honest caveat: the prompt demands crisp Chinese text, but if your model mangles the 主标题 characters, that's the image model's problem, not this node's.

Install

Two ways, same result:

cd ComfyUI/custom_nodes
git clone https://github.com/senhaicc/Comfyui-WL-MainImageDesign

Then restart ComfyUI. Or search "Comfyui-WL-MainImageDesign" in ComfyUI Manager's install dialog. No pip installs, no model downloads, no VRAM - the heavy lifting happens on whoever hosts your API model. You just need network access and a valid key.

Troubleshooting

  • [GENERATION_FAILED] in the output list - the API call failed. Open debug_info; the HTTP error and the attempted URL are right there. Console lines prefixed 🔗 and ❌ tell the same story. Nine times out of ten it's a bad key, a wrong base URL, or a model name your endpoint doesn't serve.
  • Same output twice - not a loop bug. It's the node's way of padding when the model refused to produce a valid JSON list. Check the model's raw response in debug_info.
  • Weird hands in the final images - the prompt template explicitly forces "five fingers, no broken joints, prefer side/back/silhouette shots or hands hidden behind the product." That's damage reduction, not a guarantee; bad anatomy still comes down to your checkpoint. Flux handles hands far better than SDXL-lineage models if this becomes a recurring fight.
Category🎨 WL-MainImageDesign

Inputs (20)

NameTypeDefaultDescription
api_urlSTRINGhttps://api.openai.com/v1
api_keySTRING
model_nameSTRINGgemini-2.0-flash-exp
product_typeSTRING摩托车头盔
selling_pointsSTRING碳纤维材质、轻量化设计、风噪降低
design_styleCOMBO专业机能风9 options: 专业机能风, 硬核竞技风, 工业机械风, 都市通勤风, 户外冒险风, 高端质感风, +3
scene_modeCOMBO场景融合(产品+使用情境)3 options: 场景融合(产品+使用情境), 纯产品棚拍(干净背景), 骑行动态场景(人车合一)
aspect_ratioCOMBO1:1 正方形 (800x800)2 options: 1:1 正方形 (800x800), 3:4 竖版 (600x800)
price_displayCOMBO大促价格块 (¥XX + 划线原价)4 options: 大促价格块 (¥XX + 划线原价), 角标促销价 (左下圆角框), 双价对比 (国补价 vs 原价), 不显示价格
price_valueSTRING¥299
original_priceSTRING¥599
promo_typeCOMBOTOP排名徽章 (热销第1名)7 options: TOP排名徽章 (热销第1名), 限时折扣标签 (限时X折/立减XX), 买赠活动框 (买2赠1), 新品首发标签, 官方正品徽章, 认证标签 (ECE/DOT/SNELL), +1
trust_barSTRING顺丰包邮|三年质保|7天无理由
output_languageCOMBO中文 (Chinese)2 options: 中文 (Chinese), English
seedINT00–99999
prompt_countINT31–10
product_imageoptIMAGE
product_image_2optIMAGE
product_image_3optIMAGE
product_image_4optIMAGE

Outputs (2)

NameTypeDescription
prompts_listSTRING
debug_infoSTRING