Using Variables in a Stable Diffusion Prompt

  • Use the Prompt Matrix feature in Automatic1111 to select a prompt from a text file randomly ([1]). This allows creating a pool of prompt options to mix and match.
  • Use wildcard text files with the Dynamic Prompt plugin. Store lists of options like fantasy occupations in a text file that can be randomly inserted into the prompt ([2]).
  • Use placeholders like {knight|thief|rogue|wizard|barbarian} directly in the prompt string. The options between the braces will be chosen randomly ([3]).

Specifying Settings for Each Prompt

  • The Prompt Matrix feature in Automatic1111 allows setting different parameters like steps, sampler, CFG scale, etc. for each prompt in the matrix ([4]).
  • The Dynamic Prompt plugin also allows defining prompt-specific settings using a JSON configuration ([5]).

Prompt Length and Formatting

  • Be careful when saving very long prompts – it may crash Google Drive. Uncheck “save_samples” if using extremely long prompts ([6]).
  • The maximum prompt length depends on the Stable Diffusion model. For example, v1 has a 75 token limit ([9]).
  • Use Markdown formatting for structure when possible – headings, lists, etc. LaTeX for math. Format images from search results using Markdown ().

Prompt Engineering Best Practices

  • Be as specific as possible with many details ([11]). Carefully choose descriptive keywords ([12]).
  • Use negative prompts to exclude unwanted elements ([9]).
  • Test and iterate on prompts – they often require refinement ([15]).
  • Mind prompt length limits and use proper punctuation to help the AI parse correctly ([15]).

Let me know if you need any clarification or have additional questions!