AIAI Club
← Back to articles
ENGLISH GUIDE

Multimodal Vision Code in Practice: Uploading Multiple Images at Once for Cross-Image Comparison and Table Extraction

How do you get AI to understand several comparison images at a glance? This hands-on guide shows you how to use Python to load local PIL image arrays, letting Gemini 1.5 extract differences across images and output a Markdown table directly.

1. Native Support for Interleaved Multimodal Text and Images

Gemini is natively a multimodal architecture, so no external image converter is needed.

2. Hands-On Code for Two-Image Spot-the-Difference and Parameter Comparison

import PIL.Image
img1 = PIL.Image.open("product_v1.png")
img2 = PIL.Image.open("product_v2.png")

prompt = "Compare the design differences between these two product prototype images, and list the added and deprecated interaction components in a Markdown table."
response = model.generate_content([prompt, img1, img2])
print(response.text)
All you need to do is put the text prompt and PIL image objects directly into the same Python list, and the model can show impressive pixel-level insight in cross-image comparison.

This English translation is based on a Chinese source article. Prices are approximate where stated and conditions should be confirmed with the official provider or seller.