Advanced Features
Unlock the full potential of Fooocus with these advanced features and techniques. This guide covers expert-level functionality for power users who want maximum control over their image generation workflow.
Wildcards
Wildcards are a powerful feature that allows you to add randomness and variation to your prompts. They're perfect for generating multiple variations or adding controlled randomness.
Basic Wildcard Syntax
Use double underscores to create wildcards: __wildcard_name__
Example: A __color__ flower in a __location__
Result: Randomly selects from color.txt and location.txt files
Creating Wildcard Files
Wildcards are defined in text files located in the wildcards directory. Each line in the file represents one option:
wildcards/color.txt:
red
blue
green
yellow
purple
Nested Wildcards
Wildcards can contain other wildcards, creating complex nested structures:
Example: A __color__ __flower_type__ in __location__
Result: Combines multiple wildcards for complex variations
Ordered vs Random Selection
By default, wildcards select randomly. You can configure ordered selection in your configuration files.
Advanced Wildcard Techniques
- Weighted wildcards (using syntax like
option:0.5) - Conditional wildcards
- Wildcard combinations
- Dynamic wildcard generation
Learn more about wildcards in our documentation.
LoRAs (Low-Rank Adaptations)
LoRAs are small model files that modify the base model to achieve specific styles, characters, or effects. Fooocus supports both inline LoRAs in prompts and LoRA presets.
Inline LoRA Syntax
Use LoRAs directly in your prompts with this syntax:
<lora:lora_name:strength>
Example: A beautiful landscape <lora:anime_style:0.8>
Where strength is a value between 0.0 and 2.0 (default is 1.0).
Multiple LoRAs
You can use multiple LoRAs in a single prompt:
Example: A character <lora:character_lora:1.0> <lora:style_lora:0.7>
LoRA Presets
Create LoRA presets in your configuration to quickly apply common LoRA combinations. This is especially useful for consistent styling across multiple generations.
- Define presets in config files
- Quick preset selection in UI
- Combine multiple LoRAs in presets
- Save and share preset configurations
Finding LoRAs
Popular sources for LoRAs include:
- Civitai - Large collection of LoRAs
- Hugging Face - Model and LoRA repository
- Community forums and Discord servers
Inpainting
Inpainting allows you to edit specific parts of an image while keeping the rest unchanged. This is perfect for fixing details, removing unwanted elements, or adding new features.
How Inpainting Works
- Load or generate a base image
- Select the area you want to modify (mask)
- Enter a prompt describing what should appear in that area
- Generate to create the inpainted result
Inpainting Techniques
- Precise Masking: Use fine-tuned masks for accurate edits
- Prompt Focus: Describe only what should appear in the masked area
- Strength Control: Adjust how much the inpainted area changes
- Seamless Blending: Ensure inpainted areas blend naturally
Best Practices
- Keep prompts focused on the masked area
- Use appropriate inpainting models for better results
- Adjust strength based on how much change you want
- Iterate with multiple passes for complex edits
Upscaling
Fooocus includes powerful upscaling capabilities to enhance your generated images to higher resolutions.
Upscaling Methods
Fooocus supports multiple upscaling algorithms:
- ESRGAN: High-quality upscaling with detail preservation
- Real-ESRGAN: Enhanced version with better artifact handling
- AI Upscaling: Model-based upscaling for best results
Upscaling Workflow
- Generate your base image at standard resolution
- Select the upscaling method
- Choose upscale factor (2x, 4x, etc.)
- Process the image
Tips for Best Results
- Start with high-quality base images
- Use appropriate upscale factors (avoid excessive upscaling)
- Consider using multiple passes for very large upscales
- Experiment with different upscaling models
Prompt Engineering
Mastering prompt engineering is key to getting the best results from Fooocus. Here are advanced techniques:
Prompt Structure
Effective prompts follow a structure:
[Subject] [Action/Pose] [Style] [Quality Modifiers] [Negative Elements]
Example:
A majestic eagle soaring over mountains, photorealistic,
high detail, 8k, professional photography, sharp focus
--neg: blurry, low quality, artifacts
Weighting and Emphasis
Use parentheses to emphasize elements:
(word)- Slight emphasis((word))- Medium emphasis(((word)))- Strong emphasis[word]- Reduce emphasis
Negative Prompts
Negative prompts help avoid unwanted elements. Use --neg: prefix:
Beautiful landscape --neg: people, buildings, text, watermark
Style Keywords
Common style keywords that work well:
- Photorealistic, hyperrealistic
- Anime style, manga style
- Oil painting, watercolor
- Cinematic, dramatic lighting
- 8k, high detail, sharp focus
Array Processing
Arrays allow you to generate multiple variations efficiently by processing multiple values in a single prompt.
Array Syntax
[[value1, value2, value3]]
Example:
[[red, green, blue]] flower
Result: Generates 3 images, one for each color
Multiple Arrays
You can use multiple arrays in one prompt:
[[red, blue]] [[flower, tree]] in garden
Result: Generates 4 images (2 colors × 2 subjects)
Arrays with LoRAs
Arrays work with inline LoRAs:
[[<lora:style1:1.0>, <lora:style2:1.0>]] landscape
Refiner Models
Refiner models enhance the quality of generated images by adding fine details and improving overall coherence.
Using Refiners
Fooocus supports automatic refiner integration. The refiner processes the image after the base model generation, adding:
- Fine details and textures
- Better color accuracy
- Improved sharpness
- Enhanced overall quality
Refiner Configuration
Configure refiner settings in your config file or through command-line options. Adjust:
- Refiner model selection
- Refiner strength
- When to apply refiner (switch point)
Performance Optimization
Optimize Fooocus for your hardware with these advanced techniques:
Memory Management
- Use
--always-low-vramfor limited VRAM - Enable
--async-cuda-allocfor better memory handling - Adjust attention mechanism for your GPU
Speed Optimization
- Use appropriate sampling methods
- Optimize step counts
- Enable CUDA optimizations
- Use batch processing efficiently
Quality vs Speed
Balance quality and speed based on your needs:
- Speed: Lower steps, faster samplers, smaller resolution
- Quality: Higher steps, quality samplers, refiner enabled
- Balanced: Medium settings for good quality and reasonable speed
Command-Line Options
Advanced users can control Fooocus through command-line options:
| Option | Description |
|---|---|
--port |
Set the web server port |
--listen |
Listen on all network interfaces |
--share |
Create a public Gradio share link |
--always-low-vram |
Always use low VRAM mode |
--always-offload-from-vram |
Offload models from VRAM when not in use |
--preset |
Load a preset configuration |
See documentation for complete CLI reference.
Advanced Workflows
Combine multiple features for powerful workflows:
Iterative Refinement
- Generate base image with general prompt
- Use inpainting to refine specific areas
- Apply upscaling for final resolution
- Use img2img for final adjustments
Style Consistency
- Create LoRA presets for consistent styling
- Use wildcards for variation within style
- Save and reuse prompt templates
Batch Generation
- Use arrays for systematic variations
- Combine wildcards with arrays
- Automate with scripts and presets