Writing effective prompts is key to generating high-quality images with AI art generators like Stable Diffusion. This article provides prompt engineering tips and examples to help you create better Stable Diffusion prompts.
The goal is to enable anyone to go from a beginner to an expert at crafting prompts that produce stunning AI art.
Anatomy of a Good Prompt
A good Stable Diffusion prompt generally consists of:
- A description of the type of image (photo, painting, etc.)
- Details on the main subject(s)
- Style cues (art movements, medium, etc.)
- Composition instructions (framing, angle, lighting)
- Quality expectations (resolution, level of detail)
Example
An oil painting portrait of a girl with red hair wearing a blue dress, rendered in a realist style with soft lighting and a tight crop on her face
This prompt describes the type of image (oil painting portrait), subject (girl with red hair in a blue dress), style (realist), composition (tight crop, soft lighting), and quality expectations (realistic).
Negative Prompts
You can also use negative prompts to specify what you DON’T want in the image:
An oil painting portrait of a girl with red hair wearing a blue dress, rendered in a realist style with soft lighting and a tight crop on her face. No trees or nature in background, no other people.
Negative prompts remove unwanted elements from the image.
Prompt Engineering Process
Here is a general process for engineering better prompts:
- Describe the basics – type of image, main subject(s), style
- Add details – hair color, clothing, accessories, etc.
- Set composition – framing, angle, lighting
- Refine quality – resolution, level of detail
- Remove unwanted elements with negative prompts
- Test and iterate – tweak prompts until satisfied
Prompting Techniques
Here are some useful techniques to try:
Emphasize Keywords
Use double parentheses around keywords to tell Stable Diffusion to pay more attention, like ((red hair))
.
Limit Variation
Adding more details limits the variation in outputs. For consistent faces, describe features precisely.
Leverage Associations
Some words have strong associations that manifest in images. Use this to your advantage.
Check for Overfitting
Too many prompts can “overfit” the model, limiting variety. Try removing prompts systematically.
Helpful Prompt Keywords
Here are some useful keywords to spice up your prompts:
- Style: renaissance, impressionist, abstract, minimalist, vector, pixel art
- Composition: cropped, zoomed in, low angle, side view, centered
- Quality: 8k resolution, photorealistic, ray tracing, depth of field
- Lighting: soft lighting, hard lighting, rim lighting, high contrast
- Color: vibrant colors, black and white, sepia tone, duotone
- Medium: oil on canvas, pen and ink, colored pencil, charcoal
- Emotion: joyful, somber, serious, friendly, ominous
Prompt Length Limits
Stable Diffusion models have token limits. A token is 1-4 characters.
In Stable Diffusion v1, the limit is ~75 tokens. So a 400 character prompt may hit the limit.
Check your provider’s documentation for the exact limit.
Conclusion
The key to generating great images with Stable Diffusion lies in crafting prompts that clearly describe what you want to create.
Follow the prompt engineering process, leverage useful techniques, and incorporate descriptive keywords that trigger the AI model to render your vision.
With practice, you’ll be able to reliably produce incredible AI art.
Useful Resources:
- Stable Diffusion Prompt Hero – Prompt search engine
- NightCafe Prompt Guide – Beginner tutorial
- LAION 400M Image Dataset – Trained Stable Diffusion