Overview

2 Easier Image Generation with Stable Diffusion Webui

The chapter introduces how to get more control out of Stable Diffusion using the A1111 web interface, building on the basics from earlier by revisiting image generation with a simple sandworm prompt. It emphasizes that the interface is powerful but still complex, and that understanding its settings is essential for improving results and keeping track of what was used to make each image.

A major focus is prompt refinement: negative prompting is used to exclude unwanted traits, while prompt attention helps the model focus more strongly on important words or concepts through parentheses or weighting syntax. The chapter also explains that Stable Diffusion works with tokens rather than plain words, which helps clarify why some prompt variations behave differently and why the token counter matters when crafting text prompts.

The chapter then explores key generation controls such as CFG scale and sampling steps. CFG scale is described as the balance between following the prompt and preserving the random noise, with higher values pushing images closer to the prompt and lower values allowing more noise-driven variation, while sampling steps affect both image quality and generation time, with too few steps producing weak results and too many often bringing diminishing returns. Finally, it shows how PNG Info can recover the prompt and settings from a generated image, making it easy to recreate, modify, and iterate on successful outputs without losing track of the configuration.

Quick refresher on the A1111 interface using our new prompt.
Images of sandworms we created with our revised prompt.
Clicking the above icon will open the folder the images are saved in.
Information contained in parts of the file name.
Recall the output from Figure 2.2.
Prompting not to do something has the opposite effect
Negative prompting produces the desired effect
More worm-like sandworms.
Increasing the attention on the term “worm”.
Token count for the word “racetrack”.
What are these weird dudes doing in here?
The CFG Scale slider
What do you see in the cloud?
Vivid imagination of our cloud as a dog.
We can image the cloud to be more like the cloud or more like the dog.
Impact of CFG Scale on the “weird dudes”.
How the rest of our images look with a CFG Scale of 11.
The Sampling steps slider.
Impact of sampling steps on the generated image.
Image of a large mouthed sandworm emerging from the dunes.
First generation of what became our final image.
Using PNG Info to be able to recreate this image.
text2img tab pre-populated with settings extracted from PNG Info.

Summary

  • Negative Prompting and Prompt attention are very helpful additions to the prompting tricks we learned last chapter to help remove properties you don’t like from your image, or enhance ones you do like.
  • Stable Diffusion works in a way that is similar to a human being looking for images in clouds. In the case of a Stable Diffusion, the “cloud” is the initial noise. The CFG scale determines how much of the noise impacts the final image. This noise can be very helpful at adding detail and texture to your image.
  • The number of sampling steps can have a big impact on how the image looks, as well as increase the time it takes to generate images. It’s best to stick with the default and then play around with our favorite images until you get it just right.
  • Most of the data needed to recreate any of the images you generated is contained in the PNG file itself and can be easily recovered with the PNG Info tab in A1111.

FAQ

What is the main purpose of using Stable Diffusion WebUI (A1111) in this chapter?The chapter uses A1111 to make Stable Diffusion easier to work with by exposing practical controls for generating and refining images. It focuses on building a foundation for using prompts, negative prompts, attention, CFG scale, sampling steps, and PNG Info to improve results.
What settings were used in the sandworm example to generate images?The example used the prompt “sandworm,” batch count of 6, batch size of 2, width 680, height 520, and seed -1. These settings were used as a quick refresher for the A1111 interface.
Why did the first “scene from a scifi movie” images include black-and-white results?Because the prompt did not specify color, the model was free to interpret the scene in a variety of ways, including black and white. The chapter uses this as an example of why negative prompting can be helpful.
What is a negative prompt in A1111?A negative prompt is a separate field that tells the model what not to create. In the chapter, using the negative prompt “black and white” helped steer the output toward full-color images.
How many negative prompt concepts should you generally use?The chapter advises not to overuse negative prompts. It suggests keeping them to about two or three concepts so they do not distract the model from the positive prompt.
What is prompt attention, and how is it used?Prompt attention is a way to make the model focus more strongly on a specific word or concept. In A1111, you can use parentheses or weighted syntax like “worm” in “sand(worm)” or “sand(worm:1.2)” to increase emphasis.
What is the difference between characters, words, and tokens in Stable Diffusion?Characters are individual letters or symbols, words are spaces-separated units, and tokens are the units the model actually processes. Tokens are closer to words than characters, but they may split words into smaller semantic pieces.
Why does the chapter say “sandworm” and “sand worm” are not a major difference for Stable Diffusion?The chapter explains that both “sandworm” and “sand worm” are treated as two tokens, so Stable Diffusion does not meaningfully distinguish them in this case. That means spelling with or without a space is not important for this specific prompt.
What does CFG scale control?CFG scale controls how strongly the image follows the prompt versus how much it stays closer to the starting noise. Lower values produce more noise-like, looser images, while higher values push the output to match the prompt more closely.
What are sampling steps, and why do they matter?Sampling steps are the number of iterations Stable Diffusion uses to turn noise into the final image. More steps can improve detail up to a point, but too many may not help and can increase generation time.
How can PNG Info help you recreate an image?PNG Info lets you drag an image into A1111 to recover the generation settings stored in its metadata. You can then use “Send to txt2img” to prefill the interface and recreate or modify the image easily.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Local Image Generation ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Local Image Generation ebook for free