0Pricing
AI Prompt Engineering · บทเรียน

องค์ประกอบของพรอมต์สร้างภาพ

องค์ประกอบด้านตัวแบบ รูปแบบ สื่อ แสง จานสี และการจัดองค์ประกอบ

องค์ประกอบของพรอมต์สร้างภาพ เป็นบทเรียน AI Prompt Engineering ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AI Prompt Engineering และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AI Prompt Engineering มีบทเรียนทั้งหมด 4 บทเรียน

พรอมต์สร้างภาพเปรียบเสมือนสูตร

พรอมต์สร้างภาพเป็น สูตร สำหรับสร้างภาพ เช่นเดียวกับการทำอาหาร ลำดับและความสมดุลของส่วนประกอบมีความสำคัญ องค์ประกอบที่ขาดหายทำให้ผลลัพธ์ดูทั่วไป ส่วนองค์ประกอบที่ไม่ถูกต้องอาจทำให้เกิดข้อผิดพลาดที่คาดไม่ถึง การเข้าใจโครงสร้างของพรอมต์อย่างถ่องแท้ช่วยให้ควบคุมงานสร้างสรรค์ได้อย่างคาดการณ์ได้

ส่วนประกอบหลักหกประการ

พรอมต์สร้างภาพที่มีคุณภาพทุกชิ้นประกอบด้วยหกส่วน ได้แก่ หัวเรื่อง (อะไร) สไตล์ (ลักษณะที่ปรากฏ) สื่อ (รูปแบบศิลปะ) แสง (การให้แสงสว่าง) จานสี (โทน) และ องค์ประกอบภาพ (การจัดกรอบ) หากละเว้นส่วนใดส่วนหนึ่ง โมเดลจะต้องคาดเดา ซึ่งโดยมากจะเลือกค่าเริ่มต้นทั่วไป

# Anatomy of an image prompt
prompt_components = {
    'subject':    'A lone lighthouse on a rocky coastline',
    'style':      'dramatic, moody, cinematic',
    'medium':     'oil painting',
    'lighting':   'stormy overcast sky, waves crashing, dramatic side-lighting',
    'color_palette': 'desaturated blues and grays with warm amber light from the lighthouse',
    'composition': 'wide establishing shot, rule of thirds, lighthouse at left third'
}

# Assemble into a prompt string
full_prompt = (
    '{subject}, {style}, {medium}, {lighting}, '
    '{color_palette}, {composition}'
).format(**prompt_components)

print(full_prompt)
# A lone lighthouse on a rocky coastline, dramatic, moody, cinematic,
# oil painting, stormy overcast sky, waves crashing, dramatic side-lighting,
# desaturated blues and grays with warm amber light from the lighthouse,
# wide establishing shot, rule of thirds, lighthouse at left third

หัวเรื่อง: อะไร

หัวเรื่องเป็นส่วนประกอบที่สำคัญที่สุด เพราะบอกโมเดลว่า ควรแสดงอะไร ควรระบุให้เจาะจงที่สุดเท่าที่ทำได้ โดยใส่สายพันธุ์ อายุ อารมณ์ การกระทำ สภาพแวดล้อม และความสัมพันธ์เชิงพื้นที่

# Subject specificity comparison

# Weak subject:
weak = 'a person in a city'

# Strong subject (same concept, much more specific):
strong = (
    'a young woman in her 30s, wearing a vintage 1960s trench coat, '
    'standing at a rain-soaked street corner in Tokyo at night, '
    'looking up at neon signs reflected in the puddles, '
    'holding a dripping umbrella, expression of quiet wonder'
)

# The strong subject answers:
# WHO: young woman, 30s
# WHAT WEARING: 1960s trench coat
# WHERE: Tokyo street corner
# WHEN: night, raining
# WHAT DOING: standing, looking up
# EXPRESSION: quiet wonder
# KEY DETAIL: neon reflections in puddles, dripping umbrella

print('Weak:', weak)
print('Strong:', strong[:100], '...')

สไตล์: ลักษณะเป็นอย่างไร

ตัวบ่งบอกสไตล์จะบอกโมเดลถึงภาษาภาพและระดับสุนทรียะของภาพ อาจอ้างอิงกระแสศิลปะ ศิลปินเฉพาะราย สื่อภาพ หรือคุณลักษณะเชิงสุนทรียะแบบนามธรรม

style_examples = [
    # Art movements
    'impressionist', 'art nouveau', 'bauhaus', 'minimalist', 'surrealist',

    # Artist references
    'in the style of Monet', 'reminiscent of Hopper', 'inspired by Klimt',

    # Visual media
    'film noir', 'vaporwave aesthetic', 'cottagecore', 'brutalist',

    # Quality descriptors
    'highly detailed', 'cinematic', 'editorial photography style',
    'concept art', 'matte painting', 'character design sheet',

    # Mood
    'ethereal', 'gritty', 'whimsical', 'melancholic', 'vibrant', 'serene'
]

# Combining styles creates unique aesthetics
combined_style = 'cyberpunk aesthetic meets art nouveau, highly detailed, dark ethereal'
print('Combined style:', combined_style)

# Warning: too many style directives create incoherence
too_many = 'impressionist, minimalist, surrealist, photorealistic, anime, baroque'
print('Too many (incoherent):', too_many)

สื่อ: รูปแบบศิลปะ

สื่อกำหนดรูปแบบศิลปะจริงหรือดิจิทัล โดยเปลี่ยนพื้นผิว คุณภาพของเส้น และโทนสีของภาพที่สร้างขึ้นอย่างมีนัยสำคัญ สื่อที่พบบ่อยและผลลัพธ์ที่สร้างได้มีดังนี้:

medium_guide = {
    # Traditional media
    'oil painting': 'Rich, textured, classic look with visible brushwork',
    'watercolor': 'Soft edges, translucent washes, paper texture visible',
    'pencil sketch': 'Line art, cross-hatching, grayscale, raw feel',
    'charcoal drawing': 'Soft, smudgy, high contrast, dramatic shadows',
    'ink illustration': 'Bold lines, flat colors or crosshatching',

    # Photography
    'photorealistic': 'Looks like a real photograph',
    'film photography': 'Grain, color shift, analog feel',
    'macro photography': 'Extreme close-up, shallow depth of field',
    'long exposure photography': 'Motion blur, light trails',

    # Digital / 3D
    '3D render': 'CGI quality, precise geometry',
    'octane render': 'Photorealistic 3D with ray-tracing quality',
    'Blender 3D': 'CGI aesthetic, often used with subdivision modeling',
    'pixel art': 'Retro 8-bit or 16-bit style, visible pixels',
    'vector illustration': 'Clean, flat, scalable design style'
}

for medium, description in list(medium_guide.items())[:5]:
    print(f'{medium}: {description}')

แสง: การกำหนดอารมณ์

แสงเป็นตัวกำหนดอารมณ์ที่ทรงพลังที่สุดอย่างหนึ่งในงานศิลปะภาพ หัวเรื่องเดียวกันจะดูแตกต่างกันอย่างสิ้นเชิงเมื่ออยู่ใต้แสงอาทิตย์ยามทองเทียบกับแสงแข็งในห้องสอบสวน ควรทำความเข้าใจคำศัพท์ด้านแสงให้เชี่ยวชาญ

lighting_vocabulary = {
    # Time of day
    'golden hour': 'Warm orange-yellow, long shadows, magic hour feel',
    'blue hour': 'Cool blue twilight, soft diffused light',
    'harsh midday': 'Hard shadows, washed-out, unflattering (usually avoided)',
    'overcast': 'Soft even light, no shadows, good for portraits',

    # Studio / artificial
    'studio lighting': 'Controlled, professional, even illumination',
    'Rembrandt lighting': 'Triangle of light on cheek, dramatic portrait technique',
    'neon lighting': 'Colorful, urban, cyberpunk feel',
    'candlelight': 'Warm, flickering, intimate',

    # Dramatic
    'chiaroscuro': 'Extreme light/dark contrast, Baroque dramatic style',
    'volumetric lighting': 'God rays, light shafts through fog or dust',
    'backlit / rim light': 'Subject outlined by light from behind, halo effect',
    'bioluminescent': 'Glowing from within, alien or underwater feel'
}

example = 'volumetric lighting, golden hour, warm glow filtering through forest canopy'
print('Lighting example:', example)

จานสี: ระดับอารมณ์

จานสีควบคุมระดับอารมณ์และความสอดคล้องทางภาพของภาพ ควรระบุจานสีด้วยคำบรรยาย หรืออ้างอิงกระแสศิลปะ ภาพยนตร์ หรือธรรมชาติ

color_palette_examples = [
    # Temperature-based
    'warm earth tones: rust, ochre, sienna, cream',
    'cool blues and silvers, icy palette',
    'neutral gray monochrome with single red accent',

    # Mood-based
    'muted, desaturated, melancholic color grading',
    'vibrant saturated colors, tropical energy',
    'pastel soft colors, dreamlike softness',

    # Reference-based
    'Wes Anderson color palette: pastel pinks and greens',
    'film noir: high contrast black and white with amber shadows',
    'synthwave neon: pink, purple, cyan on dark backgrounds',

    # Nature-based
    'autumn forest: burnt orange, golden yellow, deep brown',
    'arctic palette: white, pale blue, grey with deep navy accents',
]

# Color palettes can clash with lighting — ensure they work together
clash = 'vibrant tropical colors + film noir lighting'  # incoherent
harmony = 'warm amber and ochre tones + golden hour lighting'  # coherent

print('Harmonious combo:', harmony)

องค์ประกอบภาพ: การจัดกรอบและจุดโฟกัส

คำสั่งด้านองค์ประกอบภาพบอกโมเดลว่าจะจัดกรอบภาพอย่างไร ควรรวมอะไร เน้นอะไร และวางองค์ประกอบไว้ที่ใด การใช้คำศัพท์จากการถ่ายภาพและการถ่ายทำภาพยนตร์มาประยุกต์ใช้ได้ผลดี

composition_vocabulary = {
    # Camera distance
    'extreme close-up': 'fills frame with a single detail (eye, hand, texture)',
    'close-up': 'face or object fills most of frame',
    'medium shot': 'waist to head, character-focused',
    'wide shot': 'full body in environment context',
    'establishing shot': 'landscape/environment, tiny or no character',
    'aerial / bird\'s eye view': 'looking straight down',
    'worm\'s eye view': 'looking straight up from below',

    # Composition rules
    'rule of thirds': 'subject at intersection of 1/3 lines',
    'centered composition': 'symmetrical, formal, powerful',
    'leading lines': 'lines guide eye toward subject',
    'negative space': 'large empty area emphasizes subject',
    'frame within frame': 'archway, window, or shape frames subject',

    # Depth
    'shallow depth of field': 'sharp subject, blurred background (bokeh)',
    'deep focus': 'everything in sharp focus front to back'
}

print('Composition example: close-up portrait, rule of thirds, shallow depth of field, bokeh background')

การประกอบพรอมต์แบบเต็ม

การประกอบส่วนประกอบทั้งหกตามลำดับที่เป็นเหตุเป็นผลจะทำให้ได้พรอมต์สร้างภาพคุณภาพสูงอย่างสม่ำเสมอ ลำดับที่ดีคือ: หัวเรื่อง → สื่อ → สไตล์ → แสง → จานสี → องค์ประกอบภาพ

def build_image_prompt(
    subject, medium, style, lighting, color_palette, composition,
    quality_boost='highly detailed, 8K resolution'
):
    parts = [
        subject,
        medium,
        style,
        lighting,
        color_palette,
        composition,
        quality_boost
    ]
    # Filter out None values and join
    return ', '.join(p for p in parts if p)

# Example: Portrait
portrait = build_image_prompt(
    subject='elderly Japanese fisherman mending nets at sunrise, weathered hands, peaceful expression',
    medium='oil painting',
    style='impressionist, highly detailed, classical technique',
    lighting='golden hour sunrise, warm light from the left, soft shadows',
    color_palette='warm ochres, golds, deep navy sea in background',
    composition='medium shot, rule of thirds, subject right third, ocean left'
)
print(portrait)

การเขียนพรอมต์ให้ภาพหลายภาพมีความสอดคล้องกัน

เมื่อต้องสร้างภาพเป็นชุด เช่น แผ่นข้อมูลตัวละครหรือกระดานเรื่องราว ให้รักษาความสอดคล้องด้วยการใช้แม่แบบพรอมต์พื้นฐาน และแทนค่าตัวแปรสำหรับองค์ประกอบที่เปลี่ยนไปในแต่ละภาพ

BASE_CHARACTER_TEMPLATE = (
    '{character_description}, '
    '{action_description}, '
    'oil painting, concept art style, '
    'dramatic studio lighting, '
    'muted jewel tones with gold accents, '
    'close-up portrait, centered composition, '
    'highly detailed, cinematic'
)

character = (
    'a tall warrior woman with dark braided hair, emerald eyes, '
    'wearing ornate silver plate armor with dragon motifs'
)

action_variants = [
    'standing at attention, stoic expression, arms crossed',
    'battle-ready, sword raised, fierce expression, mid-action',
    'resting against a stone wall, exhausted but resolute, soft smile',
    'close-up portrait, neutral expression, slight three-quarter view'
]

for action in action_variants:
    prompt = BASE_CHARACTER_TEMPLATE.format(
        character_description=character,
        action_description=action
    )
    print(f'Generating: {action[:40]}...')
    # call image API with prompt

โทเค็นคุณภาพ

โมเดลสร้างภาพส่วนใหญ่ตอบสนองต่อ โทเค็นคุณภาพ ซึ่งเป็นคำที่บ่งบอกระดับความเที่ยงตรงของผลลัพธ์ที่ต้องการ ควรใช้อย่างมีกลยุทธ์เพื่อเพิ่มระดับรายละเอียดโดยไม่เปลี่ยนหัวเรื่องหรือสไตล์

quality_tokens = {
    'high_detail': [
        'highly detailed', 'intricate detail', 'ultra-detailed',
        '8K resolution', '4K wallpaper quality'
    ],
    'photorealism': [
        'photorealistic', 'hyperrealistic', 'photographed by',
        'DSLR photo', 'shot on 35mm film'
    ],
    'professional_quality': [
        'award-winning', 'professional photography', 'editorial quality',
        'museum quality', 'masterpiece'
    ],
    'rendering_quality': [
        'octane render', 'unreal engine 5', 'ray tracing',
        'subsurface scattering', 'global illumination'
    ]
}

# Best practice: add 2-3 quality tokens at the end of the prompt
quality_suffix = 'highly detailed, cinematic, 8K resolution'
print('Add to end of any prompt:', quality_suffix)

# Warning: do not overload with quality tokens — they dilute each other
too_many_quality = 'masterpiece, best quality, ultra-detailed, perfect, amazing, award-winning'
print('Over-specified (less effective):', too_many_quality[:60])

ตรวจสอบความเข้าใจ

ส่วนประกอบใดของพรอมต์สร้างภาพควบคุมอารมณ์ของภาพได้โดยตรงที่สุด

สรุปโครงสร้างของพรอมต์สร้างภาพ

พรอมต์สร้างภาพที่ประกอบอย่างดีมีส่วนประกอบหกประการที่ทำงานสอดคล้องกัน:

  • หัวเรื่อง: WHO และ WHAT — ส่วนประกอบที่สำคัญที่สุด ควรระบุให้เจาะจงอย่างยิ่ง
  • สไตล์: ระดับสุนทรียะ กระแสศิลปะ หรือการอ้างอิงศิลปิน
  • สื่อ: รูปแบบศิลปะ (ภาพวาดสีน้ำมัน, ภาพเสมือนจริง, ภาพเรนเดอร์ 3 มิติ, ศิลปะพิกเซล)
  • แสง: แสงสว่างที่กำหนดบรรยากาศ (แสงยามทอง, ไคอารอสคูโร, แสงนีออน)
  • จานสี: อุณหภูมิทางอารมณ์ (โทนสีดินอบอุ่น, สีเย็นที่ลดความอิ่มตัว, สีนีออน)
  • องค์ประกอบภาพ: การจัดกรอบ (ภาพระยะใกล้, กฎสามส่วน, ภาพเปิดฉาก)

เพิ่มโทเค็นคุณภาพ 2-3 รายการที่ท้ายพรอมต์ ใช้แม่แบบเพื่อให้ภาพในชุดหลายภาพมีความสอดคล้องกัน

คำถามที่พบบ่อย

บทเรียน “องค์ประกอบของพรอมต์สร้างภาพ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “องค์ประกอบของพรอมต์สร้างภาพ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AI Prompt Engineering ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AI Prompt Engineering มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “องค์ประกอบของพรอมต์สร้างภาพ”

องค์ประกอบด้านตัวแบบ รูปแบบ สื่อ แสง จานสี และการจัดองค์ประกอบ คุณปฏิบัติ AI Prompt Engineering ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน AI Prompt Engineering หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน AI Prompt Engineering บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “องค์ประกอบของพรอมต์สร้างภาพ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน AI Prompt Engineering นี้ได้ไหม

ได้ บทเรียน AI Prompt Engineering ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. องค์ประกอบของพรอมต์สร้างภาพ
  2. การระบุรูปแบบและสื่อศิลป์
  3. พรอมต์เชิงลบและสิ่งที่ต้องยกเว้น
  4. การปรับปรุงพรอมต์สร้างภาพแบบวนซ้ำ
← กลับไปที่ AI Prompt Engineering