Prompt Writing Basics in Stable Diffusion

The Total Beginner’s Guide to Writing Text Prompts for AI Art Generation

Maybe you saw some crazy awesome art on the internet and was shocked to learn it was generated by artificial intelligence in a matter of seconds. Or perhaps you saw a video on YouTube showing off just how far AI art software has progressed.

However you got here…welcome to the brave new world of AI art. There is very little chance that synthesized art is going away, but a very big chance it will significantly transform visual industries for better or worse.

If you’re interest in generating AI art but you’re a total beginner, this article is just one of many I have written to help you learn the basics of Stable Diffusion (a specific open-sourced and free-to-use AI art program). In this guide, I’m going to show you the meat and potatoes of prompt writing. Hopefully when you’re done with this article, you’ll have all the knowledge necessary for creating quality visual content in Stable Diffusion.

Stop, You Need a Copy of Stable Diffusion First!

If this is the first time you’ve researched AI art (or Stable Diffusion specifically), you may not know how AI software works or where to download it from. In that case, you should definitely read my guide on Installing Stable Diffusion first or learn about which AI art service fits your needs. You need a software interface before you can start entering prompts into it.

Do you have a copy of Stable Diffusion already? Then let’s get to the guide!

What is a Text Prompt?

Before we discuss how to make text prompts, you need to understand what one is.

A text prompt is a written description of what you want your AI art software to create; it’s the primary way that you explain to your AI model what you want to see and how you want it to look. There are three main components to a full text prompt:

  1. Content,
  2. Medium, and
  3. Style

1. Content

Content refers to the subject matter of your image, i.e. what is going to be in it. For example, you may ask Stable Diffusion to “draw” you an astronaut floating in deep space. Both the astronaut and the deep space he’s in are both example of subject matter.

2. Medium

Medium refers to the art materials and techniques that you want the AI to simulate. That is, the general type of art you want produced. Examples of an art medium include watercolor painting, landscape photography, and pencil sketch.

3. Style

Style refers to the specific art school or artist that you want the AI model to emulate. For example, you can ask Stable Diffusion to “paint” an astronaut in the style of Edvard Munch. Or in the style of Cubism. Both of these requests are well-defined and recognizable styles that are more definitive than what a medium alone would invoke.

Basic Parts of a Good Prompt

A well-written prompt will include at least two of these components: subject matter and either medium or style modifiers. As you experiment more and more with Stable Diffusion, you’ll discover that some subjects, mediums, and styles are easier for Stable Diffusion to synthesize. You’ll also find that combining these three components in different formats and orders can lead to different results as well. We’ll talk more about that in the section on Formatting.

Before we get any further, let’s build some very basic prompts using the component information we just reviewed to make sure you’ve got a grasp on them.

Example 1: An Oil Painting of an astronaut floating in out space

Our principal subject matter is “an astronaut”, our background matter is “out space”, and our medium is “oil painting”

Example 2: A portrait sketch of Gandalf

Our subject matter is “Gandalf” and our medium is “portrait sketch”. Specifying it as a portrait will guide the AI to give us a close-up of his face as opposed to a full body drawing.

Example 3: A cityscape at night, street photography, by Elsa Bleda

Our subject matter is “cityscape” and our medium is “street photography”. We’ve now added an artist name and a time of day as style modifiers.

Example 4: A gothic Victorian mansion by Charles Addams

Our subject matter is “Victorian mansion” and our style is “by Charles Addams”. In this example, I have foregone specifying a medium because Stable Diffusion understands that Charles Addams is a cartoonist; we can specify in the prompt that it should be a “cartoon” or “illustration”, but we can also just name an artist and see what Stable Diffusion knows about that artist first.

Formatting

You now know what a prompt is and what they need to include. So let’s discuss how to format them. By formatting, I’m referring to the order in which we mention each component and how strongly we emphasis each element.

There is no one right way to format a prompt. In fact, I encourage you to experiment with different formatting options and decide which yields the best results for your specific prompt (as Stable Diffusion may respond better to different prompts with different component orders).

However, Stable Diffusion will put more focus on the words at the beginning of your prompt. So place the most important part of your prompt first.

What Punctuation Does Stable Diffusion Use/Know?

When formatting prompts in Stable Diffusion, you need to also know what syntax and punctuation that the AI is familiar with. I have created a full guide explaining all the punctuation that you can use in Stable Diffusion. However, here is a quick overview of the most common ones:

  1. Commas – allow you to organize words together so they make sense to you, but they don’t affect the AI’s understanding of the word associations
  2. Parentheses – add emphasis to words placed inside of them. See my guide on emphasis for more information on that.
  3. Brackets – reduces emphasis of the words placed within them.

Does Stable Diffusion Care About Prepositions?

Not really, no. You can use prepositions and indefinite articles in your prompts, but the AI does not actually need them to understand the prompt. Again, it was trained on lists of tags. “a cup in a sink” will give very similar results to “cup, sink” and “cup sink”. All the extra articles don’t matter to Stable Diffusion.

Prompt: A cup in a sinkPrompt: Cup, sinkPrompt: Cup sink

All of these prompts will just give you a sink (sometimes shaped like a giant cup).

Do I Need Complete Sentences for my Stable Diffusion prompts?

No, you don’t need to use complete sentences for prompts. Stable Diffusion does not care about all the extra words, it only needs the keywords of the sentence: the nouns, verbs, and descriptors.

Everything else is just a waste of word count. But, to explain that, we’ll have to move onto the topic of prompt length…

Prompt Length

The overall length and the amount of words in your prompts do matter. A prompt can be as short as a single word, but that result will probably not look exactly how you want it. On the flip side, a prompt that is too long will actually water down the image.

For the in-depth breakdown of this topic, I recommend you read through the article I have just about length of prompts. But in summary, remember these key points:

  • Prompts are “tokenized” by the AI, which means groups of words are broken down into bits of information.
  • Stable Diffusion has a limit on the number of tokens it will pay attention to. So if your prompt gets too long, the AI will start ignoring some words/tokens or dilute their strength.
  • Redundancy will not make your images look better, so don’t add the word “detailed” six times in the prompt…Stable Diffusion won’t weight it more for being repeated.
  • Try not to tag stuff your prompts. Include only as many words as you need to get the point across, but don’t expect three different words all meaning “beautiful” to make the output images look better.

Style Modifiers

If you’ve made it this far, you now have the solid basics of writing a good AI art prompt. But there was a topic from earlier in the guide that I want to mention again. And that is styles.

Styles in this context refers to 2 things:

  1. Movements found within a general form of art or medium. For example, painting is a general art form but impressionism is an art movement with distinctive features. And
  2. Specific artists found within an art form or movement. For example, Monet was an impressionist (movement) and a painter (medium or art form).

The concept of style matters a lot in AI art generation.

Mentioning a certain movement or artist can dramatically change and improve the results of a prompt. This is because Stable Diffusion is designed to reference whatever you mention.

If you just write “painting” in your prompt, then Stable Diffusion will take into consideration any and every painting it finds relevant to your subject matter. But if you tell it to use the style of a certain artist, then it will try to inference specifically from what it knows about that artist.

Example time!

Adding Styles (Art Movement)

Prompt: beach in Fiji, paintingPrompt: beach in Fiji, painting, Hague SchoolPrompt: beach in Fiji, painting, Pointilism

Adding Styles (Artists)

Prompt: portrait of a waitressPrompt: portrait of a waitress, by Charles WaterhousePrompt: portrait of a waitress, by Roger Deakins

Just asking for a portrait can lead Stable Diffusion to making any kind of art form, because portraits can be done as photographs, paintings, drawings, etc.

When we add a name of a painter (Charles Waterhouse), Stable Diffusion knows to give us a painting because. It already understands that Waterhouse is a painting and knows what his style looks like; even more, it infers what a waitress would have looked like in one of his paintings. Waterhouse painted his most popular work between the 1950s and the 1970s. As a result, our waitress now looks like she lived in the ‘50s.

Now look at the image we get when we add the name of a cinematographer, Roger Deakins. Now the AI model knows that something made by Deakin will look like a film still from the 1980s or 1990s (his most popular films were made in those decades). As a result, the image and the subject (our waitress) have taken on a gritty ‘80s look.

And all of that was added just by adding a single artist name.

What Artists Does Stable Diffusion Know?

Knowing that art styles and artist names can affect results is essential. But a style or name is useless if the AI does not know who or what it is! So what artists does Stable Diffusion understand? To answer that, I am still working on a full article covering the topic. In the meantime, if you just want a quick directory of artists from which Stable Diffusion can infer, then check out this Notion chart.

Conclusion

Congratulations on completing this step in your AI art journey! You are now ready to dive into Stable Diffusion on your own and start testing out prompts by combining subjects, mediums, and styles.

If you found this guide helpful, then you may also enjoy these other articles I’ve written (some of them I mentioned already, but here’s a quick list in case you missed them):