stable-diffusion-image-generation

Generate images from text prompts using Stable Diffusion models via HuggingFace Diffusers.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/xu1713/openhorse --skill stable-diffusion-image-generation-xu1713
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stable-diffusion-image-generation
Source: https://github.com/xu1713/openhorse/tree/main/openhorse/openhorse/optional-skills/mlops/stable-diffusion
Command: npx skills add https://github.com/xu1713/openhorse --skill stable-diffusion-image-generation-xu1713

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires diffusers, transformers, accelerate, torch, and includes references (resource) components.

What problem does it solve? Generating custom images programmatically requires navigating complex diffusion model pipelines, schedulers, memory constraints, and model variants. This Skill provides complete guidance for text-to-image generation, image-to-image translation, inpainting, and custom diffusion workflows using the HuggingFace Diffusers library. ## Core Features & Use Cases - Text-to-Image Generation: Create images from natural language prompts using SD 1.5, SDXL, SD 3.0, or Flux models with tunable guidance scale, steps, and negative prompts. - Image Transformation & Inpainting: Perform image-to-image translation, fill masked regions, and apply ControlNet spatial conditioning (edges, poses, depth) for precise control. - LoRA & Memory Optimization: Load LoRA style adapters, enable CPU offloading, attention slicing, and xFormers to run large models on limited GPU memory. - Use Case: A developer building a product mockup tool uses SDXL with a DPM scheduler and negative prompts to generate 1024x1024 marketing visuals from text descriptions, then deploys the pipeline behind a FastAPI endpoint. ## Quick Start Ask the AI to generate an image from a text prompt using Stable Diffusion with the Diffusers library, such as creating a 1024x1024 landscape with SDXL and a fast scheduler.

Frequently Asked Questions about stable-diffusion-image-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate images from text with Stable Diffusion in Python?

Load a DiffusionPipeline from a pretrained model like stable-diffusion-v1-5 with torch.float16, move it to CUDA, then call it with a prompt, num_inference_steps, and guidance_scale. The returned images list contains PIL images you can save directly.

What is the difference between SD 1.5, SDXL, and Flux models?

SD 1.5 generates 512x512 images with lower memory needs, SDXL produces higher-quality 1024x1024 images, and Flux is a newer transformer-based model. Diffusers auto-detects the model type when loading with DiffusionPipeline.

How do I fix CUDA out of memory errors with Diffusers?

Enable model CPU offloading with pipe.enable_model_cpu_offload(), add attention slicing, and use float16 precision. For large images, enable VAE slicing and tiling, or reduce batch size and image dimensions.

How do I use ControlNet for pose or edge conditioning?

Load a ControlNetModel such as control_v11p_sd15_canny, pass it to StableDiffusionControlNetPipeline, and provide a preprocessed control image like a Canny edge map. Adjust controlnet_conditioning_scale to control conditioning strength.

Why are my generated images black or noisy?

Black images often come from VAE dtype mismatches or the safety checker; try disabling the safety checker and keeping the VAE in float32. Noisy outputs usually mean too few inference steps or a misconfigured scheduler.

When should I use DALL-E or Midjourney instead of Stable Diffusion?

Use DALL-E 3 for API-based generation without a GPU, or Midjourney for stylized artistic outputs. Stable Diffusion is preferable when you need local control, custom fine-tuning with LoRA, or pipeline customization.