How to Install and Use Z-Image on Local PC in ComfyUI: Complete 2025 Guide
Introduction
Z-Image is a powerful 6-billion parameter AI image generation model developed by Alibaba's Tongyi MAI team. Released under the Apache 2.0 license, it offers fast, high-quality image generation that runs efficiently on consumer hardware. This comprehensive guide walks you through installing and using Z-Image locally with ComfyUI, from system requirements to generating your first images.

What is Z-Image?
Z-Image is an open-source diffusion model designed for text-to-image generation. The model comes in several variants:
- Z-Image Turbo: Optimized for speed with 8-step generation
- Z-Image Base: Standard version for balanced quality and speed
- Z-Image Edit: Specialized for image editing tasks
Key advantages include:
- Low VRAM requirements: Runs on GPUs with 6-12 GB VRAM
- Fast generation: 8-step sampling produces results in seconds
- Open license: Apache 2.0 allows commercial use without restrictions
- ComfyUI integration: Native support for node-based workflows
System Requirements
Before installing Z-Image, verify your system meets these requirements:
Minimum Hardware
- GPU: NVIDIA GPU with 6 GB VRAM (8 GB recommended)
- RAM: 16 GB system memory
- Storage: 15 GB free disk space for models
- OS: Windows 10/11, Linux, or macOS
Software Prerequisites
- Python: Version 3.10 or 3.11 (3.12 not yet fully supported)
- Git: For cloning repositories
- CUDA: Version 11.8 or 12.1 for NVIDIA GPUs
Recommended Specifications
- GPU: NVIDIA RTX 3060 (12 GB) or higher
- RAM: 32 GB for optimal performance
- Storage: SSD for faster model loading
Step 1: Install ComfyUI
ComfyUI is a node-based interface for running diffusion models. Follow these steps for installation:
Windows Installation
- Clone the ComfyUI repository:
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
- Create a virtual environment:
python -m venv venv
venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Install PyTorch with CUDA support:
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
Linux Installation
- Clone and navigate to ComfyUI:
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
- Create virtual environment:
python3 -m venv venv
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
Verify Installation
Launch ComfyUI to confirm successful installation:
python main.py
Access the interface at http://localhost:8188 in your web browser.
Step 2: Download Z-Image Models
Z-Image requires three model files. Download them from Hugging Face and place them in the correct ComfyUI directories.
Required Model Files
| File Name | Size | Download Link | Destination Folder |
|---|---|---|---|
z_image_turbo_bf16.safetensors |
~12 GB | Download | ComfyUI/models/diffusion_models/ |
qwen_3_4b.safetensors |
~8 GB | Download | ComfyUI/models/text_encoders/ |
ae.safetensors |
~300 MB | Download | ComfyUI/models/vae/ |
Download Methods
Method 1: Manual Download
- Visit each Hugging Face link
- Click "Download" button
- Move files to corresponding folders
Method 2: Using Hugging Face CLI (Recommended)
# Install Hugging Face CLI
pip install huggingface-hub
# Download all models at once
huggingface-cli download Comfy-Org/z_image_turbo --local-dir ./models/z-image-turbo --include "split_files/*"
Verify Folder Structure
Confirm your directory structure matches this layout:
ComfyUI/
└── models/
├── diffusion_models/
│ └── z_image_turbo_bf16.safetensors
├── text_encoders/
│ └── qwen_3_4b.safetensors
└── vae/
└── ae.safetensors
Step 3: Update ComfyUI
Ensure ComfyUI is up-to-date for full Z-Image compatibility:
Windows:
cd ComfyUI
git pull origin master
pip install -r requirements.txt
Linux/macOS:
cd ComfyUI
git pull origin master
pip install -r requirements.txt
Restart ComfyUI after updating:
python main.py
Step 4: Load Z-Image Workflow
ComfyUI uses JSON workflow files to define node configurations. Download a pre-configured Z-Image workflow to get started quickly.
Download Workflow File
- Download the Z-Image Turbo workflow: Z-Image-Turbo-BF16-T2I.json
- Save the file to your computer
Load Workflow in ComfyUI
- Open ComfyUI in your browser (
http://localhost:8188) - Drag and drop the JSON file onto the ComfyUI canvas
- The workflow will automatically populate with all required nodes
The workflow includes:
- Text Encoder Node: Processes your text prompt
- Diffusion Model Node: Generates the image
- VAE Decoder Node: Converts latent space to visible image
- Sampler Node: Controls generation steps and quality
Step 5: Configure Generation Settings
Before generating images, configure these key parameters:
Basic Settings
Prompt: Enter your image description
- Be specific about subject, style, lighting, and composition
- Example: "A serene mountain landscape at sunset, photorealistic, 8K quality"
Steps: Set to 8 for Z-Image Turbo
- Turbo model is optimized for 8-step generation
- Higher steps don't significantly improve quality
Image Dimensions: Choose resolution
- Standard: 1024 × 1024 (square)
- Landscape: 1280 × 720 (16:9)
- Portrait: 720 × 1280 (9:16)
Advanced Settings
CFG Scale: Controls prompt adherence (recommended: 3.5-7.0)
- Lower values: More creative, less literal
- Higher values: Stricter prompt following
Seed: Controls randomness
- Use -1 for random results
- Use specific number to reproduce images
Sampler: Choose sampling method
- Recommended: Euler or DPM++ 2M
Step 6: Generate Your First Image
Follow these steps to create your first Z-Image:
- Enter your prompt in the text input node
- Verify model selection:
- Diffusion Model:
z_image_turbo_bf16.safetensors - Text Encoder:
qwen_3_4b.safetensors - VAE:
ae.safetensors
- Diffusion Model:
- Set image dimensions (e.g., 1024 × 1024)
- Click "Queue Prompt" button
- Wait for generation (typically 5-15 seconds)
- View result in the output node
Example Prompts
Photorealistic Portrait:
Professional headshot of a business executive, studio lighting,
sharp focus, neutral background, 8K quality
Fantasy Scene:
Ancient dragon perched on mountain peak, dramatic sunset,
volumetric clouds, epic fantasy art style
Architectural Visualization:
Modern minimalist house, glass walls, surrounded by forest,
golden hour lighting, architectural photography
Troubleshooting Common Issues
Out of Memory Errors
Problem: GPU runs out of VRAM during generation
Solutions:
- Reduce image resolution (try 768 × 768)
- Close other GPU-intensive applications
- Enable
--lowvramflag when launching ComfyUI:python main.py --lowvram
Model Not Found
Problem: ComfyUI can't locate model files
Solutions:
- Verify files are in correct folders
- Check file names match exactly (case-sensitive)
- Refresh ComfyUI browser page (Ctrl+R)
- Restart ComfyUI server
Slow Generation Speed
Problem: Image generation takes too long
Solutions:
- Verify CUDA is properly installed
- Check GPU is being used (not CPU):
nvidia-smi - Update GPU drivers to latest version
- Reduce image resolution temporarily
Black or Corrupted Images
Problem: Generated images appear black or distorted
Solutions:
- Verify VAE model is loaded correctly
- Try different CFG scale values (3.5-7.0)
- Check prompt doesn't contain conflicting instructions
- Regenerate with different seed value
Performance Optimization Tips
Speed Improvements
- Use SSD storage: Store models on SSD for faster loading
- Enable xFormers: Install for memory-efficient attention
pip install xformers - Batch generation: Generate multiple images simultaneously
- Reduce precision: Use bf16 models (already default for Z-Image Turbo)
Quality Enhancements
- Increase resolution: Use 1280 × 1280 or higher for detailed images
- Refine prompts: Add quality keywords like "8K", "highly detailed", "professional"
- Adjust CFG scale: Fine-tune between 5.0-7.0 for optimal results
- Use negative prompts: Specify what to avoid in generation
Advanced Usage
Image-to-Image Generation
Z-Image supports using reference images as starting points:
- Add "Load Image" node to workflow
- Connect to diffusion model input
- Set denoising strength (0.3-0.8)
- Generate variations of existing images
ControlNet Integration
For precise control over composition:
- Install ControlNet custom nodes
- Download ControlNet models
- Use edge detection, pose, or depth maps
- Guide generation with structural references
Batch Processing
Generate multiple images efficiently:
- Set batch size in workflow (2-4 images)
- Use different seeds for variation
- Process multiple prompts sequentially
- Save outputs automatically
Conclusion
You now have Z-Image running locally on your PC with ComfyUI. This setup provides:
- Full control: No cloud dependencies or usage limits
- Privacy: All generation happens on your hardware
- Customization: Modify workflows for specific needs
- Cost-effective: No per-image generation fees
Next Steps
- Experiment with prompts: Test different styles and subjects
- Explore workflows: Download community-created workflows
- Install custom nodes: Extend ComfyUI functionality
- Join communities: Share results and learn techniques
Additional Resources
- Official Z-Image Repository: GitHub
- ComfyUI Documentation: docs.comfy.org
- Model Downloads: Hugging Face
- Community Workflows: ComfyUI Registry
Start creating stunning AI-generated images today with Z-Image and ComfyUI on your local PC.