Claude With The Anthropic Api
← All lessons
Lesson 52Claude With The Anthropic Api

Image support

Summary audio

No audio recap for this lesson.

Study notes

Overview

  • Claude can process images included in user messages
  • Possible tasks: describe image content, compare images, count objects, and more

Technical Limitations & Requirements

  • Maximum 100 images per single request
  • Each image has size and dimension restrictions
  • Images consume tokens; token count can be calculated using an equation based on image height and width in pixels

Sending Images to Claude

  • Images are sent using image blocks within user messages
  • Multiple image blocks can be included in one message
  • Each image block contains either:
  • Raw image data (base64 encoded)
  • URL to an online-hosted image

Prompting Techniques for Images

  • Simple prompts with images often produce poor results
  • Strong prompting techniques dramatically improve accuracy, including:
  • Providing analysis steps for Claude to follow
  • Using one-shot or multi-shot examples
  • Giving clear guidelines

Example: Step-by-Step Analysis

  • Break down the task into sequential steps (e. g. , identify each object individually, recount using a different method, compare results)
  • Tested example: improved marble counting from incorrect count of 13 to correct count of 12

Example: One-Shot/Multi-Shot Prompting

  • Alternate image blocks and text blocks in the same message
  • Provide example image with correct answer before asking Claude to analyze the target image
  • Improves accuracy on subsequent image analysis

Practical Use Case: Fire Risk Assessment

  • Automate property inspections using satellite imagery instead of in-person visits
  • Claude can analyze: main residence location, tree density, fire service access, overhanging branches, and overall fire risk
  • Assign risk ratings (1-4) based on multiple criteria
  • Provide structured output with summary and score

Key Takeaway

  • Success with images depends on prompt quality, not just image input
  • Apply the same prompt engineering principles used for text-based tasks

Takeaways

  • Claude can process up to 100 images per request using image blocks containing base64-encoded data or URLs
  • Strong prompting techniques dramatically improve image analysis accuracy—use step-by-step instructions, examples, or multi-shot prompting rather than simple prompts
  • Images consume tokens based on their dimensions; token count can be calculated using a formula based on pixel height and width
  • Claude can automate practical tasks like fire risk assessment from satellite imagery by analyzing multiple criteria and assigning structured risk ratings
  • Success with images depends on prompt quality and engineering, not just image input alone
Flashcards 10 cards
Question
click to reveal · ←/→
Answer
click to flip back
Export to Anki (.tsv) ↓
Knowledge check 6 questions