AI prompt engineering has become an increasingly important skill for generating high-quality images from text-to-image models like Stable Diffusion. As these models continue to improve, learning how to craft effective prompts is key to unlocking their creative potential.
In this article, I’ll share my expertise on writing great AI prompts, focusing specifically on examples for Stable Diffusion. From formatting to content to prompt structure, I’ll cover everything you need to know to start creating your own prompts that produce stunning AI art.
When writing an AI prompt, structure and formatting are crucial. A well-structured prompt clearly tells the model what you want it to generate. Here are some key elements to include:
Subject and Style
Start by clearly stating the desired subject matter and style. For example:
A colorful digital painting of a wizard casting a spell
Specify whether you want a photo, painting, drawing etc. Describe the color scheme, mood, genre like fantasy or sci-fi, and other stylistic details.
Elaborate on elements you want to see in the image. For my wizard prompt, I could add:
The wizard has a long white beard, purple robes, and a tall peaked hat. He stands in a stone tower, magical energy glowing from his hands as he prepares to cast a spell, with bookshelves and potion bottles behind him.
Get creative with details! The more descriptive you are, the better.
View and Composition
Indicate the desired viewpoint, framing, pose, lighting etc. For example:
Portrait framing, dramatic side lighting creating strong shadows and contours across his face
Specify anything you explicitly don’t want to see with “no” or “without”. For example:
No modern elements, without cell phones or technology
This focuses the image on only what you specified.
Proper formatting improves prompt clarity. Use these tips:
Format your prompt with markdown for paragraphs, lists, headers etc.
Use code blocks to contain your prompt, with the language set to “text”:
A colorful digital painting of a wizard casting a spell...
This clearly separates the prompt from other text.
Wrap any math expressions in double dollar signs for LaTeX rendering, like $$x^2$$.
Now let’s look at some full prompt examples that demonstrate effective formatting and structure:
A moody digital painting of a mystical landscape with a central tower, by Greg Rutkowski and Thomas Kinkade. Misty mountains in the distance, evergreen trees, boulders, and a stone pathway leading to the tower entrance. Sunset lighting with vibrant pink and purple skies reflecting on a glassy lake surrounding the tower. Highly detailed gothic architecture, flying buttresses, stained glass windows glowing from within. No modern elements. Dramatic atmospheric perspective, cinematic lighting, depth of field blur, dynamic composition.
This prompt uses vivid descriptive details, specifies artistic style, and composition elements.
Epic cinematic scene of two futuristic spaceships in battle above an Earth-like planet, trending on ArtStation. Intricate details, volumetric light rays, lens flares, space debris. 8K resolution, Unreal Engine 5 render. Dramatic lighting, atmospheric glow around the planet.
Note the code block formatting, specified quality and composition details. The “trending on ArtStation” text encourages a refined artistic style.
Advanced Prompting Techniques
As you get comfortable with prompt writing, try these advanced techniques:
Start with a simple prompt, generate images, then add details to refine towards your vision.
Use a descriptive anchor subject, then connect it to abstract concepts through associations.
Mixed Media Prompting
Combine different mediums in one prompt like photography + digital art.
There is an art to prompt writing. With practice, you’ll learn how to guide AI image generation towards any creative vision you can imagine!
Here are some websites with more AI prompt examples and guides:
These showcase prompts for various styles and subjects, helping inspire your own creations.
With an understanding of prompt structure and formatting best practices, you can start writing prompts that produce jaw-dropping AI art. Describe your desired subject, style elements, details, composition, and any undesired elements clearly and creatively. Format with markdown, code blocks and LaTeX math. And never stop experimenting with new techniques!