ComfyUI Extension: ComfyUI-FLUX2-JSON
A comprehensive suite of custom nodes for building structured JSON prompts for FLUX.2 image generation with precision and control.
Custom Nodes (0)
README
FLUX.2 JSON Prompt Builder for ComfyUI

A comprehensive suite of custom nodes for building structured JSON prompts for FLUX.2 image generation with precision and control.
π Phase 1: Core Foundation (v1.0.0)
This initial release includes 6 essential nodes for basic FLUX.2 prompt construction:
- FLUX2_PromptAssembler π― - Master output node for final JSON assembly
- FLUX2_SceneBuilder ποΈ - Define scene context and environment
- FLUX2_StyleSelector π¨ - Choose artistic style and rendering
- FLUX2_SubjectCreator π€ - Create individual subjects with properties
- FLUX2_SubjectArray π - Collect multiple subjects into arrays
- FLUX2_CameraRig π· - Complete camera parameter control
π¦ Installation
Method 1: ComfyUI Manager (Recommended)
- Open ComfyUI Manager
- Search for "FLUX2 Prompt Builder"
- Click Install
- Restart ComfyUI
Method 2: Manual Installation
- Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/
- Clone this repository:
git clone https://github.com/MushroomFleet/ComfyUI-FLUX2-JSON.git
- Restart ComfyUI
Method 3: Direct Download
- Download this repository as ZIP
- Extract to
ComfyUI/custom_nodes/ComfyUI_FLUX2_Prompt_Builder/ - Restart ComfyUI
π― Quick Start
Basic Product Photography Workflow
1. Add FLUX2_SceneBuilder node
- Set scene_type: "Product Stage"
2. Add FLUX2_SubjectCreator node
- description: "Minimalist ceramic coffee mug"
- position: "Center foreground"
- color_1: "#000000"
3. Add FLUX2_CameraRig node
- preset: "Product Photography"
4. Add FLUX2_StyleSelector node
- style_category: "Photorealistic"
5. Add FLUX2_PromptAssembler node
- Connect all outputs to corresponding inputs
- Copy the json_string output
6. Use the JSON in your FLUX.2 generation workflow
π Node Documentation
FLUX2_PromptAssembler π―
Purpose: Master node that collects all prompt components and outputs final JSON.
Inputs:
scene(optional): Scene description from SceneBuildersubjects(optional): Subject array from SubjectArraystyle(optional): Style description from StyleSelectorcolor_palette(optional): Global color palette (array)lighting(optional): Lighting description (string)mood(optional): Mood description (string)background(optional): Background details (string)composition(optional): Composition rules (string)camera(optional): Camera object from CameraRigpretty_print(boolean): Format JSON with indentationremove_empty(boolean): Remove empty/null fields
Outputs:
json_string: Formatted JSON text (copy this to FLUX.2)json_object: Python dict for further processing
Usage: This is your final node. Connect all your prompt components here and copy the JSON output to use with FLUX.2.
FLUX2_SceneBuilder ποΈ
Purpose: Define the overall scene context and environment.
Inputs:
scene_type(required): Preset scene type or "Custom"- Options: Studio, Interior, Exterior, Product Stage, Workshop, Office, Kitchen, Living Room, Urban Street, Natural Landscape
custom_description(optional): Custom scene descriptionenvironment_details(optional): Additional environmental contexttime_of_day(optional): Morning, Afternoon, Evening, Night, Golden Hour, Blue Hourweather(optional): Clear, Cloudy, Overcast, Rainy, Foggy, Snowy
Outputs:
scene: Complete scene description string
Example:
scene_type: "Studio"
time_of_day: "Morning"
weather: "Clear"
β Output: "Professional photography studio with seamless backdrop, morning lighting, clear conditions"
FLUX2_StyleSelector π¨
Purpose: Choose artistic style and rendering approach.
Inputs:
style_category(required): Main style category- Options: Photorealistic, Film Photography, Digital Eras, Artistic, Cinematic, Technical
style_preset(optional): Specific preset within categorycustom_style(optional): Custom style descriptionquality_level(optional): Commercial quality, Editorial quality, Artistic expression, Experimentaladditional_modifiers(optional): Extra style details
Outputs:
style: Complete style description string
Categories:
- Photorealistic: Commercial, editorial, documentary photography
- Film Photography: Kodak Portra 400, Fuji Velvia 50, Ilford HP5+, etc.
- Digital Eras: Modern digital, 2000s digicam, 90s aesthetic
- Artistic: Painting styles, illustrations, minimalist design
- Cinematic: Movie-inspired looks, film noir, Wes Anderson style
- Technical: Blueprint, scientific, x-ray, infrared
FLUX2_SubjectCreator π€
Purpose: Create individual subjects with detailed specifications.
Inputs:
description(required): Detailed subject descriptionposition(optional): Manual position descriptionposition_horizontal(optional): left, center, right, etc.position_vertical(optional): top, middle, bottom, etc.position_depth(optional): foreground, midground, backgroundaction(optional): Dynamic action descriptionpose(optional): Static pose descriptioncolor_1throughcolor_4(optional): Color specifications (hex or names)
Outputs:
subject: Subject object for use in SubjectArray
Example:
description: "Vintage leather-bound journal with brass corners"
position_horizontal: "center"
position_depth: "foreground"
color_1: "#8B4513"
color_2: "#FFD700"
β Creates subject object with all properties
Position Helpers:
- Horizontal: far left, left side, center, right side, far right
- Vertical: top, upper third, middle, lower third, bottom
- Depth: foreground, midground, background
FLUX2_SubjectArray π
Purpose: Collect multiple subjects into an ordered array.
Inputs:
subject_1throughsubject_8(optional): Subject objects from SubjectCreator
Outputs:
subjects: Array of subject objects for prompt assemblysubject_count: Number of subjects in arraysummary: Quick overview of all subjects
Usage: Connect multiple SubjectCreator nodes to different input slots. Empty slots are automatically filtered out. Order mattersβsubject_1 is typically the primary/foreground element.
FLUX2_CameraRig π·
Purpose: Complete camera parameter control for photorealistic results.
Inputs:
preset(required): Camera preset or "None"- Options: Portrait, Product Photography, Landscape, Macro, Street Photography, Wide Angle
angle(optional): Camera viewing angleangle_preset(optional): Eye level, High angle, Low angle, etc.distance(optional): Shot framing (Close-up, Wide shot, etc.)lens_mm(optional): Focal length (0-400mm)lens_description(optional): Lens type descriptionf_number(optional): Aperture (f/1.4 - f/16)iso(optional): ISO sensitivity (0-6400)depth_of_field(optional): DOF descriptiondepth_preset(optional): Very shallow, Shallow, Moderate, Deep, etc.focus(optional): Focus descriptionoverride_preset(optional): Custom values override preset
Outputs:
camera: Camera object for prompt assemblycamera_summary: Text summary of settings
Presets:
- Portrait: 85mm, f/2.0, shallow DOF, eye-level angle
- Product Photography: 85mm, f/5.6, moderate DOF, slight overhead
- Landscape: 24mm, f/11, deep DOF, wide shot
- Macro: 100mm, f/2.8, very shallow DOF, extreme close-up
- Street Photography: 35mm, f/5.6, moderate DOF, eye level
- Wide Angle: 16mm, f/8, deep DOF, expansive
Lens Guide:
- 16-24mm: Ultra-wide, landscapes
- 35-50mm: Natural perspective, versatile
- 85-135mm: Portrait, flattering
- 200mm+: Telephoto, compression
Aperture Guide:
- f/1.4-2.0: Very shallow DOF (portraits)
- f/2.8-5.6: Moderate DOF (products)
- f/8-16: Deep DOF (landscapes)
π¨ Example Workflows
Example 1: Simple Product Shot
Goal: Black coffee mug on white background
SceneBuilder:
scene_type: "Studio"
SubjectCreator:
description: "Minimalist ceramic coffee mug with matte finish"
position_horizontal: "center"
position_depth: "foreground"
color_1: "#000000"
StyleSelector:
style_category: "Photorealistic"
quality_level: "Commercial quality"
CameraRig:
preset: "Product Photography"
PromptAssembler:
[Connect all above outputs]
Generated JSON:
{
"scene": "Professional photography studio with seamless backdrop",
"subjects": [
{
"description": "Minimalist ceramic coffee mug with matte finish",
"position": "center foreground",
"color_palette": ["#000000"]
}
],
"style": "Ultra-realistic product photography with commercial quality, commercial quality",
"camera": {
"angle": "Slight overhead angle, 30 degrees",
"distance": "Medium shot",
"lens-mm": 85,
"f-number": "f/5.6",
"ISO": 200,
"depth_of_field": "Moderate depth, product sharp",
"focus": "Sharp focus on product details"
}
}
Example 2: Multi-Subject Scene
Goal: Tech workspace with laptop, coffee, and plant
SceneBuilder:
scene_type: "Office"
time_of_day: "Morning"
SubjectCreator #1 (Laptop):
description: "Sleek modern laptop, open with glowing screen"
position_horizontal: "right side"
position_depth: "midground"
color_1: "#C0C0C0"
SubjectCreator #2 (Coffee):
description: "White ceramic coffee mug with steam rising"
position_horizontal: "left side"
position_depth: "foreground"
color_1: "#FFFFFF"
SubjectCreator #3 (Plant):
description: "Small succulent plant in terracotta pot"
position_horizontal: "far left"
position_depth: "midground"
color_1: "#228B22"
color_2: "#D2691E"
SubjectArray:
subject_1: [Coffee - foreground priority]
subject_2: [Laptop]
subject_3: [Plant]
StyleSelector:
style_category: "Photorealistic"
additional_modifiers: "Clean, minimalist aesthetic"
CameraRig:
preset: "Product Photography"
PromptAssembler:
[Connect all outputs]
π§ Advanced Tips
Color Management
Hex Colors:
- Always use 6-digit hex codes:
#FF0000not#F00 - Format automatically corrects to uppercase with # prefix
- Validation ensures proper hex format
Color Strategies:
- Use subject-specific colors for precise control
- Global color_palette sets overall mood
- Subject colors override global palette
Position Strategies
Using Position Helpers:
position_horizontal: "center"
position_vertical: "upper third"
position_depth: "foreground"
β Generates: "center upper third foreground"
Manual Position:
position: "Center foreground on polished concrete surface"
β Uses exactly as written
Camera Tips
Start with Presets:
- Use presets as starting points
- Enable
override_presetto customize - Adjust individual parameters as needed
Photorealism Formula:
Realistic focal length (35-85mm)
+ Appropriate aperture (f/2.8-8)
+ Proper ISO (100-400)
+ Clear focus description
= Photorealistic results
π οΈ Troubleshooting
"Subject description is required"
Solution: SubjectCreator requires a description. Fill in the description field.
JSON output is empty
Solution: Check that remove_empty is set appropriately. If all fields are empty, the output will be {}.
Camera preset not applying
Solution: Make sure override_preset is False. If True, manual settings override the preset.
Colors not appearing
Solution: Ensure hex codes start with # and are valid 6-digit hex (e.g., #FF0000).
π Roadmap
Phase 2: Visual Control (Coming Soon)
- FLUX2_HexColorPicker: Visual color selection
- FLUX2_ColorPaletteGenerator: Harmony-based palettes
- FLUX2_LightingRig: Professional lighting setups
- FLUX2_CompositionGuide: Composition rules
- FLUX2_MoodController: Emotional tone control
Phase 3: Advanced Camera (Future)
- FLUX2_LensCharacteristics: Lens effects
- FLUX2_FilmStockSimulator: Film emulation
- FLUX2_AtmosphericEffects: Environmental atmosphere
Phase 4+: Production Tools (Future)
- Template system
- Batch processing
- Multi-reference management
- Natural language conversion
- And much more!
π€ Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
π License
MIT License - See LICENSE file for details
π Citation
Academic Citation
If you use this codebase in your research or project, please cite:
@software{comfyui_flux2_json,
title = {ComfyUI FLUX2 JSON: building structured JSON prompts for FLUX.2},
author = {[Drift Johnson]},
year = {2025},
url = {https://github.com/MushroomFleet/ComfyUI-FLUX2-JSON},
version = {1.0.0}
}
Donate:
π¬ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Full Course
π Acknowledgments
- Built for the FLUX.2 image generation model
- Inspired by the FLUX.2 JSON prompting capabilities
- Community feedback and testing
π Version History
v1.0.0 (Phase 1) - Initial Release
- Core foundation nodes (6 nodes)
- Basic prompt assembly
- Scene, style, subject, camera control
- Preset libraries
- Documentation
Ready to build precise, professional prompts for FLUX.2? Install now and start creating! π
