Articles → LANGCHAIN → Gemini Image Understanding Capabilities Using Python
Gemini Image Understanding Capabilities Using Python
Sample 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
| Posted By - | Karan Gupta |
| |
| Posted On - | Monday, August 10, 2026 |