ComfyUI-Merlin: Magical Prompt Engineering Tools 🪄
Description
ComfyUI-Merlin is a custom node extension for ComfyUI, introducing two powerful tools for enhancing your prompt engineering process: the Magic Photo Prompter and the Gemini Prompt Expander. These tools allow users to easily construct detailed, high-quality prompts for photo-realistic image generation and expand existing prompts using AI.
Features 🔮
Magic Photo Prompter
- User-friendly Interface: Seamlessly integrates with ComfyUI's node-based system.
- Customizable Options: Choose from a variety of photographic elements including:
- Camera settings
- Composition shots
- Time of day
- Color grading
- Lighting
- Environment
- Dynamic Prompt Generation: Automatically combines user input with selected options to create comprehensive prompts.
- Extensible: Easily add or modify options through the
magic_options.json
file.
Gemini Prompt Expander
- AI-Powered Expansion: Utilizes Google's Gemini AI to expand and enhance input prompts.
- Structured Output: Generates expanded prompts with specific sections for Type, Subject, Outfit, Pose & Scene, Extra Details, Background, and Technical Details.
- API Key Management: Supports both manual API key input and system environment variable storage.
- Workflow Integration: Automatically updates the node's widgets in the ComfyUI workflow.
Installation
- Clone this repository into your ComfyUI
custom_nodes
folder: git clone https://github.com/Xclbr7/ComfyUI-Merlin.git - Restart ComfyUI.
Usage
Magic Photo Prompter
- Add the "Magic Photo Prompter 🪄" node to your workflow.
- Connect the node inputs as needed.
- Select options for camera, composition, time of day, color grading, lighting, and environment.
- The node will generate a comprehensive prompt based on your selections.
Gemini Prompt Expander
- Add the "Gemini Prompt Expander 🪄" node to your workflow.
- Input your initial prompt in the "input_text" field.
- Provide your Gemini API key (or set it as an environment variable).
- The node will generate an expanded, detailed prompt using AI.
Configuration
Gemini API Key
To use the Gemini Prompt Expander, you need to set up your Gemini API key. You can do this in three ways:
- Input the API key directly in the node.
- Set it as an environment variable named
GEMINI_API_KEY
. - For Windows users, it will be stored in the System Environment Variables after the first use.
Customizing Magic Photo Prompter Options
You can modify the options available and add more in the Magic Photo Prompter by editing the magic_options.json
file located in the same directory as the node scripts.