Articles → LANGCHAIN → Gemini Image Understanding Capabilities Using Python

Gemini Image Understanding Capabilities Using Python






Sample Image




Picture showing the sample spartan image



Install Library




pip install google-genai pillow



Code


from google import genai
from PIL import Image

# Your Gemini API key
GEMINI_API_KEY = "your api key"

# Create Gemini client
client = genai.Client(api_key=GEMINI_API_KEY)

# Load the image
img = Image.open("spartan.jpg")

# Prompt
prompt = """
Look at this image and describe what you see.

Include:
1. Main objects
2. People, if any
3. Colors and appearance
"""

# Send image + prompt to Gemini
response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents=[prompt, img]
)

# Print the response
print("\n--- Gemini Response ---\n")
print(response.text)



Output


Picture showing the explanation given by gemini for the spartan image





Posted By  -  Karan Gupta
 
Posted On  -  Monday, August 10, 2026

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250