How to Run Stable Diffusion on Your Local Desktop
How to Run Stable Diffusion on Your Local Desktop
Stable Diffusion is a powerful open-source AI model that generates images from text prompts (like “a castle floating in space”) using a process called diffusion. It was developed by Stability AI and quickly became one of the most popular AI image generators due to its high quality, open licensing, and flexibility.
Key features:
- Generates highly detailed images from natural language prompts
- Can be fine-tuned or customized (e.g., trained on your own art style)
- Runs on both local hardware and cloud services
Why Run Stable Diffusion Locally?
While cloud-based services (like Midjourney or DreamStudio) are convenient, running Stable Diffusion locally offers several benefits:
- Privacy: Your prompts and generated images stay on your machine.
- Free: No tokens, subscriptions, or credits needed.
- Customization: Load different models, tweak settings, or fine-tune on your own data.
- Offline Access: No internet required after installation.
How to Run Stable Diffusion Locally
Here’s how to set up Stable Diffusion on Windows. You’ll need a machine with a GPU (ideally with at least 6–8 GB of VRAM).
Choose a UI (Recommended: Automatic1111 WebUI)
The easiest way to run Stable Diffusion is using a community tool like AUTOMATIC1111’s Web UI, which adds a friendly browser interface and tons of features.
Requirements
Minimum System Requirements:
- GPU: NVIDIA GTX 1060 (6 GB VRAM) or better
- RAM: 8–16 GB
- Disk Space: ~10 GB (more if using multiple models)
- OS: Windows 10/11 (This should also work on macOS (Apple Silicon), or Linux but has not been tested by me)
Tools You’ll Need:
- Git
- Python 3.10.x (!Important - Later version may error)
- NVIDIA GPU with CUDA support (for performance)
Installation (Windows)
Open a terminal and follow these steps:
Clone the WebUI Repo
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git cd stable-diffusion-webui
(Optional) Create a Python Virtual Environment
python -m venv venv
Activate venv on Windows:
venv\Scripts\activate
Download a Stable Diffusion Model
You can place model checkpoints into the following folder...
models/Stable-diffusion/
Example: Download v1-5-pruned-emaonly.ckpt or v1-5.safetensors from Hugging Face and place it here: stable-diffusion-webui/models/Stable-diffusion/
Run the Web UI
python launch.py
The first run will install dependencies automatically. Afterward, open your browser and go to:
http://127.0.0.1:7860
Prompts for Photo-Realistic Images
Key Factors for Photorealism:
-
Prompt Structure: While less rigid than some other AI art tools, a well-structured prompt helps guide the model. A common structure is:
- Subject Description: Detailed description of the main subject (e.g., "close-up portrait of an elderly man, deep wrinkles, expressive eyes").
- Environment/Background: (e.g., "lush green forest with sunlight filtering through the leaves," "bustling street market").
- Composition/Shot Type: (e.g., "full body shot," "close-up," "wide angle," "portrait").
- Lighting: Crucial for realism (e.g., "golden hour," "dramatic lighting," "soft sunlight," "studio lighting," "natural light").
- Camera/Photography Terms: (e.g., "RAW photo," "DSLR photo," "8K resolution," "ultra quality," "sharp focus," "tack sharp," "film grain," "Fujifilm XT3," "cinematic lighting," "bokeh," "f/1.4 aperture").
- Quality Keywords: (e.g., "highly detailed," "intricate details," "photorealistic," "hyperrealistic," "realistic skin texture," "skin pores," "glossy eyes").
- Artist/Photographer Style (Optional): Sometimes adding a specific photographer's name can influence the style (e.g., "by Annie Leibovitz").
-
Negative Prompts: These are just as important as positive prompts for pushing away unwanted styles. Always include terms that steer the model away from artificiality:
negative prompt: disfigured, ugly, bad anatomy, bad hands, bad eyes, missing limbs, extra limbs, deformed, blurry, low resolution, low quality, cartoon, anime, 3d, render, illustration, painting, drawing, sketch, watermark, text, signature, CGI, fake, doll, plastic, unrealistic
-
Sampling Method and Steps:
- Sampler: Experiment with different samplers.
DPM++ 2M Karras
is often recommended for realism. - Sampling Steps: While more steps generally mean more detail, there's a point of diminishing returns. 20-40 steps are often sufficient for good results, and going much higher may not significantly improve quality but will increase generation time.
- Sampler: Experiment with different samplers.
-
CFG Scale (Classifier-Free Guidance Scale): This controls how strongly the image follows your prompt.
- Lower values (e.g., 3-7): More creative freedom for the AI.
- Higher values (e.g., 7-12, sometimes higher for specific models): Stricter adherence to the prompt. For photorealism, you often want a medium-to-higher range.
- Resolution: Generating at higher resolutions helps with detail. Consider using the "Hires. fix" feature in AUTOMATIC1111 to upscale images effectively.
Example Photorealistic Prompts:
Here are some examples of prompts you can adapt, combining the elements above:
-
Portrait:
Positive:
Close-up portrait of a young woman, natural light, soft shadows, sharp focus on eyes, highly detailed skin texture, subtle freckles, gentle smile, bokeh background, RAW photo, DSLR photo, 8K, intricate details, photorealistic, by Peter Hurley
Negative:
disfigured, ugly, bad anatomy, cartoon, anime, painting, blurry, low quality, mutated, extra limbs
-
Landscape:
Positive:
Hyperrealistic landscape photo of a winding river through a lush green valley at golden hour, dramatic clouds, sun rays filtering through trees, clear water reflections, detailed foliage, rocks, wide angle, 8K, cinematic lighting, ultra quality
Negative:
cartoon, painting, illustration, blurry, low resolution, abstract, distorted
-
Object/Still Life:
Positive:
Detailed photograph of a steaming cup of coffee on a wooden table, scattered coffee beans, soft studio lighting, shallow depth of field, sharp focus, water droplets on cup, hyperrealistic, food photography, 8K
Negative:
blurry, messy, ugly, low quality, drawing, cartoon, painting, fake
Experimentation is Key!
The best way to get amazing results is to experiment with different models, prompt combinations, negative prompts, and settings. Keep track of what works and what doesn't. Many Stable Diffusion communities (like on Reddit, Discord, or Civitai) share prompts and settings, which can be a great starting point for your own creations.
Final Thoughts
Running Stable Diffusion on your local desktop gives you full control over your creative AI experience. With tools like AUTOMATIC1111, you don’t need to be a Python expert to explore AI image generation.
Whether you're an artist, game developer, or just exploring what’s possible, local Stable Diffusion gives you creative power without the limits of cloud-based tools.