Skip to main content

Prompt Engineering

Introduction

Creating an image that matches a certain expectation is not as trivial as one might expect. The solution space of the AI model is insanely high. To limit this a well engineered prompt can be used to steer the AI in the right direction. This practice is called Prompt Engineering.

Prompt guides

Resource references

Prompt perfecters

Using ChatGPT to optimize the prompt is efficient, because it is not always clear how the AI will respond to a certain prompt. There are templates available to help kickstart the prompt perfectioning via ChatGPT.

SD-Web-UI Forge workflow

To get as close to the imagined concept and as efficiently as possible, the following workflow is proposed:

  1. Database selection:
    1. Checkpoint selection: Each model is trained for specific output. Use the right one! (Multiple can be combined)
    2. Add additional LoRa or LyCORIS files to improve specific features (download at: https://civitai.com/models) 
  2. Prompt creation:
    1. Use prompt perfector to get to a good descriptive prompt
    2. Use CLIP Interrogator to retrieve a prompt from an example image that can be used to get detailed prompts for specific features
    3. Use a fixed seed, in order to same results for the same prompt.
  3. Choose settings:
    1. Choose proper sampling method. Each method has it's own benefits and downsides.
    2. Use relative low resolution, but at the desired aspect ratio. Exact resolution is depending on the used database models (e.g. 512x512, 768x768, 1024x1024 px).
  4. Image generation:
    1. Iterate the prompt until the concept is mainly displayed.
  5. Finalize the details:
    1. Move to the img2img tab to use inpainting to improve certain aspects
  6. Upscale image:
    1. Move to Extras tab and set higher resolution and iterations. Fine-tune the prompt until all details are correct.
  7. Save image and save prompt & settings.

Prompt format

A good prompt exists of (most) of the following topics:

  1. Subject
  2. Medium
  3. Style
  4. Art-sharing website
  5. Resolution
  6. Additional details
  7. Color
  8. Lighting

Subject

  • Description (What kind of subject is it?)
    • Professions, like: 'artist, magician, knight'
    • Clothes or accessories
    • Body features, like: 'brown hair, blue eyes'
  • Action (what is the subject doing?)
    • Running, jumping, dancing, etc.
  • Pose (Which pose should the subject have? Only relevant for creatures!)
  • Location (Where in the picture should the subject be displayed?)
  • Orientation (From which direction should the subject be displayed?)
    • Use camera angle descriptions, like: 'low angle'
  • Distance (From which distance should the subject be displayed?)
    • Use camera shot descriptions, like: 'medium shot'
    • Use length units, like: 'viewed from 100 meters'

Medium

The medium is the type of picture, like: illustration, oil painting, 3D rendering, digital art and photography.

Style

The style refers to the artistic style of the image. Examples include impressionist, surrealist, pop art. Use the SDXL Styles Editor for quickly selecting a preset.

Resolution

Resolution represents how sharp and detailed the image is, like: highly detailed and sharp focus.

Additional details

Color

Lighting