Reverse Image Search
Find the source, similar images, or context for any image using reverse image search engines.
Setup
On first use, create a Python venv and install the dependency:
CODEBLOCK0
INLINECODE0 is included here because the current PicImageSearch import path needs it on this machine's Python 3.14 runtime.
Usage
CODEBLOCK1
- - imageurlor_path: HTTP(S) URL or local file path
- engine:
yandex (default, most reliable), google (Google Lens path), bing, or INLINECODE4 - limit: Max results per engine (default: 10)
Output is JSON with matched results including title, URL, thumbnail, and similarity when available.
If every selected engine fails due to upstream scraper breakage or anti-bot responses, the script exits non-zero so the caller can retry or fall back instead of treating the run as a clean success.
For Yandex hard failures, the error object includes attempt_log and diagnostics (including debug_html_path files in /tmp) so you can inspect exactly what response variant was received.
Engine Selection
- - yandex — Best overall: most stable, good at finding exact matches and similar images
- google — Uses Google Lens via PicImageSearch; useful as a secondary source
- bing — Useful as supplementary source
- all — Run
yandex first, then fall back to Google Lens and Bing only if Yandex is insufficient
Typical Workflow
- 1. User provides image (URL or file attachment)
- Run search with
yandex first - Only if
yandex is insufficient, retry with INLINECODE12 - Summarize findings: source, context, similar images
Do not start with all unless the user explicitly asks for all engines at once.
反向图片搜索
使用反向图片搜索引擎查找任意图片的来源、相似图片或上下文信息。
环境配置
首次使用时,创建Python虚拟环境并安装依赖:
bash
SKILL_DIR=$(dirname SKILL.md)
python3 -m venv $SKILL_DIR/scripts/.venv
$SKILLDIR/scripts/.venv/bin/pip install -q PicImageSearch typingextensions
此处包含typing_extensions是因为当前PicImageSearch的导入路径在该机器的Python 3.14运行时中需要此依赖。
使用方法
bash
SKILL_DIR=$(dirname SKILL.md)
$SKILLDIR/scripts/.venv/bin/python3 $SKILLDIR/scripts/search.py <图片URL或路径> [搜索引擎] [结果数量]
- - 图片URL或路径:HTTP(S)网址或本地文件路径
- 搜索引擎:yandex(默认,最可靠)、google(Google Lens路径)、bing或all
- 结果数量:每个引擎的最大结果数(默认:10)
输出为JSON格式,包含匹配结果,包括标题、URL、缩略图及相似度(如可用)。
如果所有选定的引擎因上游爬虫故障或反机器人响应而失败,脚本将以非零状态退出,以便调用方可以重试或回退,而不是将此次运行视为完全成功。
对于Yandex的严重故障,错误对象包含attemptlog和diagnostics(包括/tmp中的debughtml_path文件),以便检查收到的具体响应变体。
引擎选择
- - yandex — 整体最佳:最稳定,擅长查找精确匹配和相似图片
- google — 通过PicImageSearch使用Google Lens;适合作为辅助来源
- bing — 适合作为补充来源
- all — 先运行yandex,仅在Yandex结果不足时回退到Google Lens和Bing
典型工作流程
- 1. 用户提供图片(URL或文件附件)
- 首先使用yandex运行搜索
- 仅当yandex结果不足时,使用all重试
- 汇总发现:来源、上下文、相似图片
除非用户明确要求同时使用所有引擎,否则不要以all开始。