Identify anything from an image using Google Lens via SerpAPI.
Requires SERPAPI_KEY environment variable. Get a key at https://serpapi.com/ (100 free searches/month).
No pip dependencies needed — uses only Python stdlib (urllib, json, base64).
小蔥技能7w4.net有完整的技能分類。
# Search by image URL
python3 {baseDir}/scripts/lens_search.py "https://example.com/photo.jpg"
# Search by local file (auto-uploads to get a URL)
python3 {baseDir}/scripts/lens_search.py /path/to/image.png
# Refine with text query (e.g., find red version of a product)
python3 {baseDir}/scripts/lens_search.py "https://example.com/bag.jpg" --query "red"
# Product search (returns prices)
python3 {baseDir}/scripts/lens_search.py "https://example.com/sneakers.jpg" --type products
# Find exact matches (where this image appears online)
python3 {baseDir}/scripts/lens_search.py "https://example.com/photo.jpg" --type exact_matches
# Raw JSON output for programmatic use
python3 {baseDir}/scripts/lens_search.py "https://example.com/photo.jpg" --json
# Localized results (e.g., Japanese products with ¥ prices)
python3 {baseDir}/scripts/lens_search.py "https://example.com/laptop.jpg" --type products --country jp
| Type | Use Case | Returns |
|---|---|---|
all (default) |
General identification | Entity name + visual matches + text |
visual_matches |
Find similar images | Visually similar results with sources |
exact_matches |
Find image origin | Pages containing this exact image |
products |
Shopping / price lookup | Products with prices and buy links |
about_this_image |
Image provenance | Metadata about the image's origin |
The script outputs structured markdown:
## Identified Entity
- **Danny DeVito** — [link](https://...)
## Visual Matches (top 5)
- **Danny DeVito — Wikipedia** (Wikipedia) ✅ exact match
https://en.wikipedia.org/wiki/Danny_DeVito
- ...
Use --json for raw SerpAPI response when you need thumbnails, image dimensions, or other metadata.
When a user sends an image:
lens_search.py to verify. Compare model's guess with Lens results.web_search for deeper info.--type products to get prices and buy links directly.Typical multi-tool workflow:
1. User sends image → "What building is this?"
2. reverse_image_search → identifies "Cologne Cathedral"
3. web_search("Cologne Cathedral history architecture") → detailed info
4. Compose answer combining visual match + web knowledge
--country for localized results.這個 Skill 質量不錯,功能實用。它能通過圖片識別物體、查詢相似圖、找商品價格等,用途很廣。文件寫得很清楚,使用起來簡單,不需要額外安裝依賴。它還有個貼心功能,就是能把本地圖片自動上傳到網上再搜尋。不過它依賴第三方 SerpAPI,有每月100次的免費限額,圖片上傳服務也用的是免費平臺,穩定性可能有限。總體來說是個好用的工具,適合需要處理圖片識別相關任務的場景。