What You'll Learn
Learn the optimal width, height, and aspect ratio settings for AI image models including Stable Diffusion, SDXL, and Flux Dev. Includes comprehensive dimension tables and best practices.
Video Walkthrough
Prefer watching to reading? Follow along with a step-by-step video guide.
Width & Height
AI Image Generation: Width and Height Guide
When generating images with AI models like Stable Diffusion, Flux, and other image generation models, the width and height parameters are crucial settings that significantly affect your final result.
Width and height determine both the size and aspect ratio of your generated image. Each AI model has an optimal range of dimensions where it performs best, based on the resolution it was trained on.
Quick Reference Tool
For pixel-perfect dimensions optimized for any AI model, use our AI Image Aspect Ratio Calculator. It provides one-click copying of dimensions in multiple formats with real-time megapixel calculation and constraint validation.
Optimal Dimensions by Model
Stable Diffusion Models
| Model | Resolution | Notes |
|---|---|---|
| Stable Diffusion 1.5 | 512×512 pixels (1:1) | Trained on 512px resolution |
| Stable Diffusion 2.1 | 768×768 pixels (1:1) | Trained on 768px resolution |
| Stable Diffusion XL (SDXL) | 1024×1024 pixels (1:1) | Trained on 1024px with 15+ supported aspect ratios |
| SDXL Turbo | 512×512 pixels | Optimized for speed at lower resolution |
| SDXL Lightning | 1024×1024 pixels | Same as SDXL base |
| Pony Diffusion | 1024×1024 pixels | SDXL-based |
Modern AI Image Models
| Model | Resolution | Notes |
|---|---|---|
| Flux Dev | 1024×1024 or 1MP equivalents | Flexible megapixel targeting with 32px increment constraints |
| Flux Schnell | Same as Flux Dev | Optimized for speed |
| Hunyuan DiT | 1024×1024 pixels | Recommended |
| Qwen VL (Image) | 1024×1024 or higher | Flexible dimensions |
| Kolors | 1024×1024 pixels | Similar to SDXL |
SDXL Supported Aspect Ratios
SDXL natively supports these resolutions for optimal quality:
| Width × Height | Aspect Ratio | Use Case |
|---|---|---|
| 1024 × 1024 | 1:1 (square) | Social media, icons |
| 1152 × 896 | 9:7 | Portrait orientation |
| 896 × 1152 | 7:9 | Portrait orientation |
| 1216 × 832 | 19:13 | Landscape photos |
| 832 × 1216 | 13:19 | Portrait photos |
| 1344 × 768 | 7:4 | Wide landscape |
| 768 × 1344 | 4:7 | Tall portrait |
| 1536 × 640 | 12:5 | Ultra-wide |
| 640 × 1536 | 5:12 | Ultra-tall |
Flux Dev Recommended Dimensions
Flux Dev works with dynamic megapixel targeting and requires dimensions in 32px increments:
| Width × Height | Aspect Ratio | Megapixels |
|---|---|---|
| 1024 × 1024 | 1:1 | ~1.0 MP |
| 1344 × 768 | 16:9 | ~1.0 MP |
| 768 × 1344 | 9:16 | ~1.0 MP |
| 1216 × 832 | 3:2 | ~1.0 MP |
| 832 × 1216 | 2:3 | ~1.0 MP |
| 1536 × 1024 | 3:2 | ~1.6 MP |
| 1024 × 1536 | 2:3 | ~1.6 MP |
Legacy Models
For older Stable Diffusion models, here are the recommended dimensions:
| Width × Height | Aspect Ratio | SD 1.5 | SD 2.1 |
|---|---|---|---|
| 512 × 512 | 1:1 (square) | ✓ | – |
| 768 × 512 | 3:2 | ✓ | – |
| 512 × 768 | 2:3 | ✓ | – |
| 768 × 576 | 4:3 | ✓ | – |
| 896 × 512 | 16:9 | ✓ | – |
| 768 × 768 | 1:1 (square) | – | ✓ |
| 1152 × 768 | 3:2 | – | ✓ |
| 768 × 1152 | 2:3 | – | ✓ |
| 1024 × 768 | 4:3 | – | ✓ |
| 1152 × 648 | 16:9 | – | ✓ |
Best Practices
- Stay close to training resolution: Each model performs best at or near its native training resolution
- Respect minimum dimensions: Never go below the minimum edge length the model was trained on (512px for SD 1.5, 768px for SD 2.1, 1024px for SDXL/Flux)
- Use proper constraints: Many models require dimensions divisible by 8, 32, or 64 pixels
- Consider megapixels: Higher megapixel values mean slower inference. Lower resolutions generate faster
- Match aspect ratio to content: Use portrait ratios for people, landscape for scenery, square for social media
- Use the calculator: Visit aspect.promptingpixels.com for pixel-perfect dimensions that avoid generation errors
Impact on Quality
Different aspect ratios and dimensions can significantly influence the final output quality:
- Images generated at non-native resolutions may show artifacts or reduced quality
- Extreme aspect ratios (like 16:9) work better with SDXL and Flux than older models
- Upscaling from native resolution often produces better results than generating at high resolution directly
- Composition and framing can be affected by aspect ratio choice
Video Generation Models
Note: Some AI models like Wan 2.2 are designed for video generation (text-to-video and image-to-video) rather than static image generation. These models have different resolution requirements.
| Model | Supported Resolutions | Details |
|---|---|---|
| Wan 2.2 T2V | 480P, 720P | Generates 5-second videos at 24fps using 1280×720 (720P) or 854×480 (480P) |
Want More AI Image Tutorials?
Get the best AI image tutorials and tool reviews—no spam, just 1 or 2 helpful emails a month.
Continue Learning
More How It Works Tutorials
Explore additional tutorials in the How It Works category.
View All Tutorials