Negative Prompts und Ausschlüsse
Was ausgeschlossen werden soll: blurry, watermark, ugly, deformed – effektives Negative Prompting.
Negative Prompts und Ausschlüsse ist eine kostenlose AI Prompt Engineering-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des AI Prompt Engineering-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der AI Prompt Engineering-Kurs umfasst insgesamt 4 Lektionen.
Was sind negative Prompts?
Negative Prompts teilen einem Bildmodell mit, was es nicht in das erzeugte Bild aufnehmen soll. Sie werden getrennt vom positiven Prompt angegeben und lenken die Generierung von unerwünschten Artefakten, Stilen und Elementen weg. Das Konzept stammt ursprünglich aus Stable Diffusion und hat sich inzwischen auf verschiedene Bildgenerierungsmodelle ausgeweitet.
Syntax negativer Prompts in Stable Diffusion
In Stable Diffusion werden negative Prompts als separater Parameter übergeben. Das Modell behandelt sie als Anti-Guidance: Konzepte aus dem negativen Prompt werden während der Generierung aktiv vermieden.
import requests
SD_API_URL = 'http://localhost:7860/sdapi/v1/txt2img'
def generate_sd_image(positive_prompt, negative_prompt, steps=30, cfg_scale=7):
payload = {
'prompt': positive_prompt,
'negative_prompt': negative_prompt,
'steps': steps,
'cfg_scale': cfg_scale, # 7-12 recommended
'width': 512,
'height': 512,
'sampler_name': 'DPM++ 2M Karras'
}
response = requests.post(SD_API_URL, json=payload)
return response.json()
# Example call with negative prompt
positive = (
'portrait of a young woman, soft natural light, '
'professional photography, sharp focus, elegant'
)
negative = (
'blurry, watermark, text, logo, ugly, distorted, '
'deformed, extra fingers, extra limbs, bad anatomy, '
'low quality, low resolution, grainy, noisy, '
'oversaturated, harsh shadows'
)
result = generate_sd_image(positive, negative)
print('Generated:', len(result.get('images', [])), 'images')Der universelle negative Qualitäts-Prompt
Eine standardisierte Zusammenstellung negativer Prompt-Begriffe verbessert die Ausgabequalität bei fast jedem Motiv. Merken oder speichern Sie sie als standardmäßigen Ausgangspunkt.
# Universal quality negative prompt
QUALITY_NEGATIVES = [
# Technical quality issues
'blurry', 'out of focus', 'low quality', 'low resolution',
'pixelated', 'grainy', 'noisy', 'compressed artifacts', 'jpeg artifacts',
# Anatomical distortions (common AI failure mode)
'extra fingers', 'extra limbs', 'extra arms', 'deformed hands',
'bad anatomy', 'malformed', 'mutated', 'disfigured',
# Unwanted elements
'watermark', 'text', 'logo', 'signature', 'caption',
'border', 'frame', 'username',
# Stylistic failures
'ugly', 'poorly drawn', 'amateur', 'sketch',
'unfinished', 'rough draft',
# Color problems
'oversaturated', 'washed out', 'overexposed', 'underexposed'
]
UNIVERSAL_NEGATIVE = ', '.join(QUALITY_NEGATIVES)
print('Universal negative prompt:')
print(UNIVERSAL_NEGATIVE[:200], '...')Negative Prompts für Anatomie und Körper
KI-Bildmodelle haben bekanntermaßen Schwierigkeiten mit Händen und Fingern. Spezifische negative Anatomie-Prompts verringern diese Artefakte bei der Generierung menschlicher Figuren deutlich.
ANATOMY_NEGATIVES = [
# Hand and finger issues
'extra fingers', 'missing fingers', 'deformed fingers',
'fused fingers', 'too many fingers', 'six fingers',
'wrong number of fingers', 'extra hands', 'floating hand',
# Face issues
'distorted face', 'asymmetrical face', 'multiple faces',
'merged faces', 'duplicate head', 'two heads',
'extra eyes', 'missing eyes', 'heterochromia (if not desired)',
# Body proportions
'extra legs', 'extra arms', 'floating limbs',
'bad proportions', 'unrealistic body proportions',
'torso too long', 'missing torso',
# Skin
'skin blemishes', 'skin texture issues'
]
BODY_NEGATIVE = ', '.join(ANATOMY_NEGATIVES)
# Full portrait negative prompt combining quality + anatomy
PORTRAIT_NEGATIVE = UNIVERSAL_NEGATIVE + ', ' + BODY_NEGATIVE
print('Portrait negative length:', len(PORTRAIT_NEGATIVE.split(',')), 'terms')Stile mit negativen Prompts ausschließen
Mit negativen Prompts lassen sich unerwünschte Stile ausschließen – das ist nützlich, wenn Stilbegriffe im positiven Prompt ähnliche Stile anziehen, die Sie vermeiden möchten. Häufige Stilausschlüsse:
style_exclusion_examples = [
{
'goal': 'Oil painting portrait without cartoonish look',
'positive': 'oil painting portrait, classical technique, highly detailed',
'negative': 'cartoon, anime, illustration, flat colors, cel-shaded, vector'
},
{
'goal': 'Photorealistic image without HDR over-processing',
'positive': 'photorealistic landscape, natural light, DSLR quality',
'negative': 'HDR, hyper-saturated, over-processed, Instagram filter, tone-mapped'
},
{
'goal': 'Dark fantasy without gore',
'positive': 'dark fantasy warrior, dramatic lighting, detailed armor',
'negative': 'gore, blood, violence, disturbing content, horror'
},
{
'goal': 'Vintage look without actual age degradation',
'positive': 'vintage 1960s photograph, film grain, warm tones',
'negative': 'deteriorated, damaged, torn, stains, yellowed, faded'
}
]
for ex in style_exclusion_examples[:2]:
print(f'Goal: {ex["goal"]}')
print(f'Negative: {ex["negative"][:60]}...')
print()DALL-E-Syntax zum Vermeiden
DALL-E 3 verfügt über kein separates Feld für negative Prompts. Stattdessen werden Ausschlüsse natürlich im positiven Prompt formuliert, etwa mit 'avoid', 'without', 'no' oder 'do not include'.
import openai
client = openai.OpenAI(api_key='YOUR_API_KEY')
# DALL-E 3: exclusions in the positive prompt
dalle_prompt_with_exclusions = (
'A professional portrait photograph of a businesswoman in a modern office. '
'Natural window light, shallow depth of field, warm tones. '
'Do not include: any text, watermarks, logos, or captions. '
'Avoid: cartoon or illustrated style, anime, artificial-looking skin. '
'The image should have no distracting background elements. '
'Realistic and natural — not over-processed or filtered.'
)
response = client.images.generate(
model='dall-e-3',
prompt=dalle_prompt_with_exclusions,
size='1024x1024',
quality='hd',
n=1
)
image_url = response.data[0].url
print('Generated image URL:', image_url[:60], '...')Stärke negativer Prompts und CFG-Skala
In Stable Diffusion steuert die CFG-Skala (Classifier-Free Guidance), wie stark der Prompt (sowohl der positive als auch der negative) die Generierung beeinflusst. Ein höherer CFG-Wert führt zu einer stärkeren Befolgung, kann aber Artefakte verursachen.
# CFG scale guide for Stable Diffusion
cfg_guide = {
3: 'Very loose adherence, creative/random, may ignore negative prompts',
5: 'Balanced: creative but follows prompts generally',
7: 'Standard: good balance of quality and adherence (recommended default)',
10: 'Strong adherence: follows both positive and negative prompts closely',
12: 'Very strong: highly literal, may oversaturate colors or cause artifacts',
15: 'Extreme: usually causes artifacts, rarely useful'
}
# Parenthetical weighting in Stable Diffusion
# Surround a term with () to increase its weight
# surround with [] to decrease its weight
weighted_negative = (
'(blurry:1.3), (extra fingers:1.5), watermark, '
'[slight noise:0.5], text'
# extra fingers gets 1.5x negative weight (most important to avoid)
# blurry gets 1.3x negative weight
# slight noise gets reduced 0.5x weight (tolerate a little)
)
print('CFG=7 (recommended default) balances quality and prompt adherence')
print('Weighted negative example:', weighted_negative[:80], '...')Eine Bibliothek für negative Prompts aufbauen
Für unterschiedliche Anwendungsfälle werden unterschiedliche Zusammenstellungen negativer Prompts benötigt. Bauen Sie eine Bibliothek mit bereichsspezifischen negativen Prompts auf, die sich für jede Generierungsaufgabe miteinander kombinieren lassen.
NEGATIVE_PROMPT_LIBRARY = {
'quality_base': (
'blurry, low quality, low resolution, pixelated, '
'watermark, text, logo, signature'
),
'anatomy': (
'extra fingers, deformed hands, bad anatomy, '
'extra limbs, distorted face'
),
'portrait_specific': (
'double chin exaggerated, skin blemishes, '
'red eye, harsh shadows on face'
),
'landscape_specific': (
'overcast flat light, washed out colors, '
'lens flare, chromatic aberration'
),
'product_photo': (
'shadow on product, uneven background, '
'reflection glare, dust spots'
),
'no_style_bleed': (
'anime, cartoon, illustration, painting, '
'sketch (when photorealism is desired)'
)
}
def compose_negative(*keys):
return ', '.join(NEGATIVE_PROMPT_LIBRARY[k] for k in keys)
# Portrait generation
portrait_neg = compose_negative('quality_base', 'anatomy', 'portrait_specific')
print('Portrait negative:', portrait_neg[:100], '...')
# Product photo generation
product_neg = compose_negative('quality_base', 'product_photo', 'no_style_bleed')
print('Product negative:', product_neg[:100], '...')Wenn negative Prompts versagen
Negative Prompts sind keine Garantie – sie verringern die Wahrscheinlichkeit unerwünschter Elemente, beseitigen sie jedoch nicht vollständig. Wenn Sie verstehen, wann sie versagen, können Sie realistische Erwartungen entwickeln.
negative_prompt_limitations = {
'Failure: Concept too abstract': {
'problem': '"bad" is too vague for the model to act on',
'fix': 'Use specific concrete terms: "blurry", "deformed", "watermark"'
},
'Failure: Contradiction with positive prompt': {
'problem': 'Positive: "detailed painting" | Negative: "painting"',
'fix': 'Narrow negative to the specific aspect: negative: "amateur painting, rough sketch"'
},
'Failure: Too many negative terms dilute effect': {
'problem': '200-word negative prompt where each term gets minimal weight',
'fix': 'Limit to 15-20 terms. Use weighting for most critical: "(extra fingers:1.5)"'
},
'Failure: Watermarks still appear': {
'problem': 'Some model checkpoints are strongly trained on watermarked data',
'fix': 'Use a different model checkpoint or use an inpainting pass to remove'
}
}
for failure, info in negative_prompt_limitations.items():
print(f'{failure}')
print(f' Problem: {info["problem"]}')
print(f' Fix: {info["fix"]}')
print()Wirksamkeit negativer Prompts testen
Testen Sie systematisch, welche negativen Prompts die Ergebnisse für Ihren spezifischen Anwendungsfall tatsächlich verbessern. Generieren Sie Bilder mit und ohne negative Prompts und vergleichen Sie die Ausgaben mit einem festen Seed.
import requests
SD_API_URL = 'http://localhost:7860/sdapi/v1/txt2img'
def test_negative_prompts(positive, negative_variants, seed=42, steps=30):
results = []
for label, negative in negative_variants.items():
payload = {
'prompt': positive,
'negative_prompt': negative,
'seed': seed, # fixed seed for fair comparison
'steps': steps,
'cfg_scale': 7
}
response = requests.post(SD_API_URL, json=payload)
results.append({
'label': label,
'negative': negative[:60] + '...',
'image_count': len(response.json().get('images', []))
})
return results
# Test different negative prompt levels
variants = {
'no_negative': '',
'quality_only': 'blurry, low quality, watermark',
'anatomy_added': 'blurry, low quality, watermark, extra fingers, bad anatomy',
'full_library': compose_negative('quality_base', 'anatomy', 'portrait_specific')
}
print('Testing negative prompt variants with fixed seed...')
print('Compare output images to identify which negative terms have the most impact.')Midjourney-No-Parameter
Midjourney verwendet den Parameter --no als Gegenstück zum negativen Prompt. Die Syntax ist anders, das Konzept jedoch identisch: Hängen Sie --no [term1] [term2] am Ende des Prompts an.
# Midjourney negative prompt syntax using --no parameter
midjourney_prompts = [
# Basic exclusion
'professional headshot portrait, soft studio lighting, --no text watermark logo background',
# Style exclusion
'oil painting of a medieval castle, dramatic lighting --no modern cars people telephone wires',
# Anatomy
'full body character art, hero pose --no extra fingers deformed limbs bad anatomy',
# Content exclusion
'children\'s book illustration of a forest --no violence scary dark horror'
]
# Midjourney also supports emphasis with :: weighting
weighted_midjourney = (
'A serene Japanese garden::2, cherry blossoms::1.5, '
'koi pond, stone lantern --no people tourists modern buildings::3'
# ::2 = 2x weight on the garden
# ::3 on the no-people exclusion = very strong exclusion
)
for prompt in midjourney_prompts[:3]:
print('Midjourney:', prompt[:70], '...')Kurzer Wissenstest
Welche Stable-Diffusion-Technik erhöht den Einfluss eines bestimmten negativen Begriffs gegenüber anderen?
Zusammenfassung negativer Prompts
Negative Prompts sind ein leistungsfähiges Werkzeug, um die Bildgenerierung von unerwünschten Eigenschaften wegzulenken:
- Stable Diffusion: separater Parameter
negative_prompt; unterstützt Gewichtung in Klammern - DALL-E 3: 'avoid', 'without' und 'do not include' im positiven Prompt verwenden
- Midjourney:
--no [terms]an den Prompt anhängen - Universelle negative Begriffe: unscharf, geringe Qualität, Wasserzeichen, Text, zusätzliche Finger
- CFG-Skala: steuert, wie stark positive und negative Prompts die Generierung lenken
- Einschränkungen: Verringern die Wahrscheinlichkeit, garantieren aber keinen Ausschluss; maximal 15–20 Begriffe
Häufig gestellte Fragen
Ist die Lektion „Negative Prompts und Ausschlüsse“ kostenlos?
Ja — der vollständige Text von „Negative Prompts und Ausschlüsse“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des AI Prompt Engineering-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der AI Prompt Engineering-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Negative Prompts und Ausschlüsse“?
Was ausgeschlossen werden soll: blurry, watermark, ugly, deformed – effektives Negative Prompting. Du übst AI Prompt Engineering mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um AI Prompt Engineering zu starten?
Keine Vorkenntnisse erforderlich. AI Prompt Engineering auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.
Wie lange dauert die Lektion „Negative Prompts und Ausschlüsse“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser AI Prompt Engineering-Lektion Code schreiben und ausführen?
Ja. Jede AI Prompt Engineering-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Anatomie eines Bildgenerierungs-Prompts
- Stil und künstlerisches Medium spezifizieren
- Negative Prompts und Ausschlüsse
- Iterative Verfeinerung von Bild-Prompts