Z-image-Prompting-Json
Details
Download Files
Model description
只是一個簡單的COMFYUI節點,靈感來自於社群討論https://www.reddit.com/r/StableDiffusion/comments/1p809wt/
雖然我的結論是直接輸入json內容不行會在圖片中產生大量的錯誤資訊
但這個想法可以產生結構化的prompts
直接把z_image_json_prompt.py放到IComfyUI\custom_nodes底下就行
他會自動產生一個目錄產生所需的檔案
z_image_json_prompt.json則是示範工作流
Z-image JSON Prompting for ComfyUI
A ComfyUI custom node for generating structured, detailed prompts in JSON format, inspired by the community discussion on Reddit.
画像を表示 画像を表示 画像を表示
💡 Concept
While directly feeding JSON to image models produces artifacts and errors (as tested), this node takes a different approach:
✅ Generate structured JSON prompts for organization and reusability
✅ Convert to optimized text prompts for actual image generation
✅ Maintain detailed prompt components in a readable format
Think of it as a prompt construction framework rather than direct JSON-to-image generation.
✨ Features
📋 Triple Output Format
JSON Output - Complete structured prompt with all components
Text Output - Optimized positive prompt for image generation
Negative Prompt - Separate negative guidance
🎨 Detailed Component Categories
Inspired by professional photography and filmmaking workflows:
CategoryComponentsSceneOverall scene descriptionSubjectType, skin detail, attire, hair, position, expressionActionPrimary action, visual effectsEnvironmentSetting, background elements, atmosphereCameraLens specs, angle, film simulationLightingStyle, key light, fill light, contrastStyleMedium, aesthetic, quality, color palette, special layers
🎲 Smart Randomization
Each parameter supports
random,none, or manual selectionAuto-generates from curated option files
Easily customizable via text files
🔄 Automatic Setup
Creates
z_image_optionsfolder on first runAuto-generates all option files with defaults
No manual configuration needed
📦 Installation
Method 1: Direct Download (Recommended)
Download
z_image_json_prompt.pyPlace it in:
ComfyUI/custom_nodes/Restart ComfyUI
The node will automatically create the
z_image_optionsfolder with all necessary files
Method 2: Git Clone
bash
cd ComfyUI/custom_nodes/
git clone https://github.com/yourusername/z-image-json-prompting
# Restart ComfyUI
Folder Structure (Auto-generated)
ComfyUI/
└── custom_nodes/
├── z_image_json_prompt.py
└── z_image_options/ # Auto-created on first run
├── scene_description.txt
├── subject_type.txt
├── skin_detail.txt
├── attire_detail.txt
└── ... (22 more option files)
🚀 Usage
Basic Workflow
Add the node: Search for
Z-image JSON Promptingin ComfyUIConfigure parameters: Choose from dropdowns or use "random"
Connect outputs:
json_prompt→ Text display or save node (for documentation)positive_text→ Your image model's positive promptnegative_prompt→ Your image model's negative prompt
Example Workflow
A demo workflow is included: z_image_json_prompt.json
To use:
Drag
z_image_json_prompt.jsoninto ComfyUIThe workflow demonstrates all three outputs
Customize parameters as needed
Output Examples
JSON Output:
json
{
"scene_description": "Hyper-realistic street photography merged with explosive 2D old-school hip-hop graffiti doodles",
"subject": {
"type": "Cool Black/Latino young man, early 20s, street-dancer build",
"skin": "Natural skin texture, subtle pores, light sweat sheen",
"attire": "Oversized white graphic tee, olive cargo pants with fabric folds",
"hair": "Fresh medium-length twist sponge curls",
"position": "Dynamic low crouch, one knee down",
"expression": "Eyes half-closed, subtle smirk, zoned into the beat"
},
"camera_settings": {
"lens": "35mm f/1.4 prime, shot at f/2.0",
"angle": "Low-angle street photography perspective"
},
...
}
Text Output (for image generation):
Hyper-realistic street photography merged with explosive 2D old-school hip-hop graffiti doodles, 8K resolution insanely sharp, Ultra-detailed photorealistic photography, Subject: Cool Black/Latino young man early 20s street-dancer build, wearing oversized white graphic tee olive cargo pants, dynamic low crouch one knee down, eyes half-closed subtle smirk, deep in the music feeling the bass drop, Setting: Grimy NYC-style subway platform at night, low-angle street photography perspective, harsh overhead fluorescent lighting, raw urban energy rhythmic loud youthful rebellion
🎨 Customization
Editing Options
All options are stored in plain text files under z_image_options/:
bash
# Example: Edit subject types
nano z_image_options/subject_type.txt
Format: One option per line
Cool Black/Latino young man, early 20s, street-dancer build
Elegant Asian woman, late 20s, professional model physique
Mysterious hooded figure, ageless, lean athletic build
# Add your own here
Adding New Options
Simply add new lines to any .txt file - they'll appear in the dropdown on next restart.
🔧 Parameters Reference
Scene Level (1 parameter)
scene_description- Overall scene overview and style description
Subject (6 parameters)
subject_type- Character type, age, buildskin_detail- Skin texture, pores, complexion detailsattire_detail- Clothing description with fabric and wear detailshair_style- Hair length, style, conditionposition- Body pose and positioningexpression- Facial expression and mood
Action (2 parameters)
primary_action- Main action or activityvisual_effect- Special visual effects accompanying the action
Environment (3 parameters)
setting- Location and environment descriptionbackground_elements- Specific background detailsatmosphere- Overall mood and atmospheric conditions
Camera Settings (3 parameters)
lens_spec- Lens type, focal length, aperturecamera_angle- Camera positioning and perspectivefilm_simulation- Film stock emulation settings
Lighting (4 parameters)
lighting_style- Overall lighting approachkey_light- Primary light source descriptionfill_light- Secondary/fill lighting detailscontrast_level- Shadow and highlight contrast
Style (5 parameters)
render_medium- Rendering style and mediumaesthetic- Overall artistic directionquality_setting- Resolution and quality descriptorscolor_palette- Color scheme and tonespecial_layer- Special effects or overlay styles
🤔 Why Not Direct JSON Input?
After testing (as discussed in the Reddit thread), feeding raw JSON directly to Stable Diffusion models produces:
❌ Text artifacts in the image
❌ JSON syntax appearing as visual elements
❌ Poor understanding of the actual intended content
This node solves that by:
✅ Storing prompt structure as JSON (for organization)
✅ Converting to optimized text (for generation)
✅ Preserving both formats (for flexibility)
📊 Use Cases
1. Professional Workflows
Maintain detailed prompt documentation
Version control for complex prompts
Team collaboration with structured formats
2. Prompt Libraries
Save JSON prompts as reusable templates
Mix and match components
Build prompt collections systematically
🐛 Troubleshooting
Node doesn't appear after installation
Ensure the file is in
ComfyUI/custom_nodes/Restart ComfyUI completely
Check console for Python errors
Options not loading
The
z_image_optionsfolder will auto-create on first runIf missing, delete and let it regenerate







