여러 이미지 비교 프롬프트
두 개 이상의 이미지에서 차이점, 공통점 및 시간에 따른 변화를 비교합니다.
여러 이미지 비교 프롬프트은(는) CoddyKit의 무료 AI Prompt Engineering 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Prompt Engineering 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
다중 이미지 프롬프트
시각 모델은 한 번의 API 호출로 여러 이미지를 처리할 수 있습니다. 이를 통해 강력한 비교 작업을 수행할 수 있습니다.
- 전후 분석(제품 사진, 방 개조, 의료 영상)
- 제품 변형 비교(색상 옵션, 크기 비교)
- 품질 비교(목록에 사용할 최적의 사진 선택)
- 변경 사항 탐지(문서의 두 버전, 시간 정보가 기록된 두 이미지)
다중 이미지 프롬프트에서는 모델이 각 이미지가 무엇인지, 어떤 관계를 분석해야 하는지 알 수 있도록 구조를 세심하게 구성해야 합니다.
한 번의 호출로 여러 이미지 보내기
API는 여러 이미지를 콘텐츠 항목의 목록으로 받습니다. 각 이미지에 명시적으로 라벨을 지정합니다.
import anthropic, base64
client = anthropic.Anthropic(api_key='YOUR_API_KEY')
def compare_images(image_path_1, image_path_2, comparison_prompt):
def encode(path):
with open(path, 'rb') as f:
return base64.standard_b64encode(f.read()).decode('utf-8')
r = client.messages.create(
model='claude-opus-4-5', max_tokens=600,
messages=[{'role': 'user', 'content': [
{'type': 'text', 'text': 'IMAGE 1:'},
{'type': 'image', 'source': {'type': 'base64', 'media_type': 'image/jpeg', 'data': encode(image_path_1)}},
{'type': 'text', 'text': 'IMAGE 2:'},
{'type': 'image', 'source': {'type': 'base64', 'media_type': 'image/jpeg', 'data': encode(image_path_2)}},
{'type': 'text', 'text': comparison_prompt}
]}]
)
return r.content[0].text
print('Multi-image comparison function defined.')두 제품 비교 프롬프트
소비자 대상 애플리케이션에서 두 제품 이미지를 비교하는 경우입니다.
product_comparison_prompt = '''
Compare the two product images above (Image 1 and Image 2).
Analyze each of the following dimensions:
1. SIMILARITIES: What features, design elements, or characteristics do both products share?
2. DIFFERENCES: What are the key visual differences? Focus on:
- Color and finish
- Size and proportions (estimate if possible)
- Design style (minimalist, ornate, modern, traditional)
- Materials (if discernible)
- Quality indicators
3. QUALITY ASSESSMENT: Which image appears to show a higher-quality product, and why?
Rate each product 1-10 for apparent quality.
4. USE CASE: Based on appearance alone, which product seems better suited for:
a) Professional/office use
b) Home/casual use
Return your response in this format exactly.
'''
print(product_comparison_prompt)전후 비교
전후 프롬프트에서는 어느 이미지가 전이고 후인지, 변환의 맥락이 무엇인지 명시적으로 설정해야 합니다.
before_after_prompt = '''
You are looking at two images: a BEFORE image (Image 1) and an AFTER image (Image 2).
Analyze the transformation:
1. WHAT CHANGED: List all visible changes from Before to After
2. WHAT STAYED THE SAME: List elements that are unchanged
3. QUALITY IMPROVEMENT: Rate the improvement on a scale of 1-10 (1=no improvement, 10=dramatic improvement)
4. REMAINING ISSUES: What could still be improved that the transformation did not address?
Context: This is a [CONTEXT_PLACEHOLDER] before/after comparison.
Return JSON:
{
"changes": ["string"],
"unchanged": ["string"],
"improvement_score": 1-10,
"remaining_issues": ["string"],
"summary": "one sentence summary"
}
'''
# Use contexts: room renovation, product refurbishment, skin care treatment, document cleanup
print('Before/after prompt with JSON output defined.')사진 품질 선택
여러 선택지 중 최적의 사진을 선택하는 작업으로, 전자 상거래, 소셜 미디어, 출판 작업 흐름에 유용합니다.
import anthropic, base64, json
client = anthropic.Anthropic(api_key='YOUR_API_KEY')
def select_best_photo(image_paths, use_case='e-commerce product listing'):
def encode(path):
with open(path, 'rb') as f:
return base64.standard_b64encode(f.read()).decode('utf-8')
content = []
for i, path in enumerate(image_paths):
content.append({'type': 'text', 'text': f'IMAGE {i+1}:'})
content.append({'type': 'image', 'source': {'type': 'base64', 'media_type': 'image/jpeg', 'data': encode(path)}})
prompt = f'''
You have received {len(image_paths)} images. Select the best one for: {use_case}
Evaluate each on: lighting, composition, clarity, and suitability for the use case.
Return JSON: {{"best_image": 1-{len(image_paths)}, "score_breakdown": [{{"image_id": int, "score": 1-10, "reason": str}}]}}
'''
content.append({'type': 'text', 'text': prompt})
r = client.messages.create(model='claude-opus-4-5', max_tokens=300, messages=[{'role': 'user', 'content': content}])
return json.loads(r.content[0].text)
print('Photo selection function defined.')변경 사항 탐지 프롬프트
같은 이미지의 두 버전 사이에서 특정 변경 사항을 탐지하는 작업으로, 문서 버전 관리, 사용자 인터페이스 설계 검토, 모니터링에 유용합니다.
change_detection_prompt = '''
Compare Image 1 (version A) with Image 2 (version B) of the same item.
Identify ALL changes, no matter how small.
For each change:
- Describe what changed
- Where in the image the change occurs (use quadrant: top-left, top-right, bottom-left, bottom-right, center)
- Classify the change: addition, removal, modification, movement
Return JSON:
{
"total_changes": int,
"changes": [
{
"description": str,
"location": str,
"type": "addition|removal|modification|movement"
}
],
"is_significant_change": true | false
}
If the images appear identical, return: {"total_changes": 0, "changes": [], "is_significant_change": false}
'''
print(change_detection_prompt)A/B 설계 비교
두 설계 변형을 객관적으로 비교하는 작업으로, 사용자 인터페이스/사용자 경험 결정과 창작 방향 설정에 유용합니다.
design_comparison_prompt = '''
You are an experienced UX designer reviewing two design variants (Image 1 = Design A, Image 2 = Design B).
Evaluate both designs on:
1. VISUAL HIERARCHY: Which design guides the eye more effectively? Why?
2. READABILITY: Which has better text legibility and information density?
3. BRAND CONSISTENCY: Which feels more professional and polished?
4. USABILITY: Which would be easier for a new user to navigate?
5. EMOTIONAL IMPACT: Which creates a stronger positive first impression?
For each dimension, declare a winner (A or B) and explain in one sentence.
Final verdict: Return JSON:
{
"winner": "A|B|tie",
"dimension_winners": {"visual_hierarchy": str, "readability": str, "brand": str, "usability": str, "emotional": str},
"winning_reasons": [str],
"recommendation": str
}
'''
print('Design comparison prompt defined.')구조화된 유사도 점수 산정
자동화된 처리 과정에서는 이미지 간 유사도를 숫자 점수로 출력합니다.
similarity_prompt = '''
Compare these two images and provide a structured similarity analysis.
Return JSON:
{
"overall_similarity": 0.0-1.0,
"dimensions": {
"subject_match": 0.0-1.0,
"color_match": 0.0-1.0,
"composition_match": 0.0-1.0,
"style_match": 0.0-1.0
},
"key_differences": [str],
"are_same_item": true | false | "cannot_determine"
}
Scoring: 1.0 = identical, 0.0 = completely different.
'''
import json
def similarity_score(image_path_1, image_path_2):
result_text = compare_images(image_path_1, image_path_2, similarity_prompt)
return json.loads(result_text)
print('Similarity scoring function defined.')
print('Use case: duplicate detection, product matching, visual search.')두 개보다 많은 이미지 처리
이미지가 세 개 이상이면 추가되는 복잡성을 처리할 수 있도록 프롬프트를 구성합니다.
def multi_image_prompt(n_images):
image_labels = ', '.join(f'Image {i+1}' for i in range(n_images))
return f'''
You have received {n_images} images: {image_labels}.
Rank all {n_images} images from best to worst for use as a product hero image.
For each image, provide:
- Rank (1=best)
- Score 1-10
- Key strengths
- Key weaknesses
Return JSON:
{{
"ranking": [
{{"rank": int, "image_id": int, "score": int, "strengths": [str], "weaknesses": [str]}}
],
"recommended_image": int
}}
'''
# Works for 3, 4, or 5 images
print(multi_image_prompt(3)[:300])다중 이미지 프롬프트의 일반적인 문제
여러 이미지로 작업할 때 흔히 발생하는 실수와 이를 방지하는 방법입니다.
- 이미지 라벨 없음: 모델이 각 이미지가 무엇인지 혼동할 수 있습니다 — 각 이미지 앞에 항상 IMAGE 1:과 같은 텍스트로 라벨을 지정합니다.
- 비교 기준 없음: 비교할 차원을 지정하지 않고 비교를 요청하면 초점이 없는 출력이 생성됩니다 — 비교할 항목을 정확히 나열합니다.
- 맥락 누락: 전후 프롬프트에는 변환의 맥락이 필요합니다(방 사진 두 장만 제시하지 말고 방 개조라는 맥락을 제공해야 합니다).
- 이미지가 너무 많음: 이미지가 6장 이상이면 품질이 저하됩니다 — 2~4장씩 묶어서 처리합니다.
- JSON 출력 누락: 서술형 비교는 구문 분석이 어렵습니다 — 처리 과정에서는 항상 구조화된 JSON을 요청합니다.
시간 순서 이미지 분석
이미지가 시간 순서를 나타내는 경우(주간 점검, 공사 진행 상황, 의료 후속 진료), 비교 프롬프트에서 시간에 따른 진행 과정을 명시적으로 분석해야 합니다.
temporal_prompt = '''
You are analyzing a sequence of images taken over time.
Image 1 = earliest, Image 2 = most recent.
Analyze the progression:
1. PROGRESS: What improvements or changes occurred from earliest to most recent?
2. REGRESSION: Any deterioration or negative changes?
3. RATE: Is the rate of change faster, slower, or as expected?
4. TRAJECTORY: Based on the trend, what is the likely state in the next period?
Return JSON:
{
"progress": [str],
"regression": [str],
"change_rate": "faster|on_track|slower|stalled",
"trajectory": str,
"next_period_prediction": str
}
'''
print("Temporal sequence analysis prompt defined.")
print("Use cases: fitness progress, construction tracking, medical imaging follow-up.")빠른 확인
다중 이미지 비교 프롬프트에 포함해야 할 가장 중요한 구조적 요소는 무엇인가요?
다중 이미지 비교 — 핵심 요점
다중 이미지 비교 프롬프트를 사용하면 강력한 시각 분석 기능을 활용할 수 있습니다.
- 콘텐츠 배열에서 각 이미지 앞에 텍스트를 넣어 항상 이미지를 명시적으로 라벨링합니다.
- 일반적인 비교를 요청하는 대신 시각적 위계, 품질, 유사도와 같은 비교 기준을 지정합니다.
- 전후 프롬프트에는 변환의 맥락이 필요합니다(어떤 종류의 변화가 발생했는지).
- 처리 과정에서는 구조화된 JSON 출력을 사용합니다 — 유사도 점수, 순위 목록, 변경 사항 탐지에 활용할 수 있습니다.
- 제품 비교, 사진 품질 선택, A/B 설계 검토는 가치가 높은 사용 사례입니다.
- 묶음은 최대 2~4장으로 유지합니다 — 이미지가 많아지면 품질이 저하됩니다.
- 변경 사항 탐지 프롬프트에서는 각 변경 사항을 추가, 제거, 수정, 이동 유형으로 분류해야 합니다.
자주 묻는 질문
“여러 이미지 비교 프롬프트” 강의는 무료인가요?
네 — “여러 이미지 비교 프롬프트” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Prompt Engineering 강의 전체를 잠금 해제할 수 있습니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
“여러 이미지 비교 프롬프트”에서 뭘 배우나요?
두 개 이상의 이미지에서 차이점, 공통점 및 시간에 따른 변화를 비교합니다. 브라우저에서 직접 실행하는 실습 코드로 AI Prompt Engineering을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
AI Prompt Engineering을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 AI Prompt Engineering은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“여러 이미지 비교 프롬프트” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 AI Prompt Engineering 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 AI Prompt Engineering 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 이미지 설명과 캡션 작성 프롬프트
- 시각적 질문 답변
- 여러 이미지 비교 프롬프트
- OCR 및 문서 분석 프롬프트