DSH 的本地微信 OCR 工具:`wechat_ocr_recognize` 针对本地图片路径返回识别文本和引擎的结构化结果。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:hawkhai/wechat-ocr
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Great thanks to IEEE by his Project IEEE/QQImpl] and article.
This project is based on it and reduced the product size by using protobuf-lite instead of protobuf.
This project provided a direct Python interface for calling in sync mode as well as other languages support including but not limited with c++/java/c#.
DeepSeek Harness plugin
This repository can be installed as a DeepSeek Harness plugin:
dsh plugin add github:hawkhai/wechat-ocr
It registers wechat_ocr_recognize, a model-facing tool that accepts a local image path and returns recognized text together with WeChat OCR's structured result. OCR runs locally; the image is not sent to an external OCR service.
Configure wechatOcrPath (the WeChat 3.x WeChatOCR.exe, WeChat 4.x wxocr.dll, or Linux OCR binary) and wechatPath (the matching WeChat runtime directory) in the plugin row. You may instead set WECHAT_OCR_PATH and WECHAT_PATH. The default python must match one of the bundled Windows extension builds (CPython 3.7, 3.11, or 3.12); pythonBin and moduleDir are configurable.
Prepare for usage
To work with this project, you need to prepare the wechat OCR binary and the wechat runtime folder.
For wechat 3.x, the wechat OCR binary is wechatocr.exe, it might be:
C:\Users\yourname\AppData\Roaming\Tencent\WeChat\XPlugin\Plugins\WeChatOCR\7061\extracted\WeChatOCR.exe
and the wechat runtime folder might be:
C:\Program Files (x86)\Tencent\WeChat\[3.9.8.25]
Wechat 4.0 is now supported!
For wechat 4.0, the wechat OCR binary is wxocr.dll, it might be:
C:\Users\yourname\AppData\Roaming\Tencent\xwechat\XPlugin\plugins\WeChatOcr\8011\extracted\wxocr.dll
and the wechat runtime folder might be:
C:\Program Files\Tencent\Weixin\4.0.0.26
Warning
WeChat 4.0 OCR binary is wxocr.dll, but this project built a DLL named wcocr.dll
Their names are similar, DO NOT confuse them.
Linux is now supported

Typically, You should use /opt/wechat/wxocr as the OCR exe path and /opt/wechat/ as the WeChat folder path.
The other usages are similar to those on Windows.
C++ interface
You can use the following code to test it:
CWeChatOCR ocr(wechatocr_path, wechat_path);
if (!ocr.wait_connection(5000)) {
// error handling
}
CWeChatOCR::result_t result;
ocr.doOCR("D:\\test.png", &result);
You can also pass nullptr to the second parameter of doOCR to call in async mode and wait the callback.
In this case, you need to subclass CWeChatOCR and implement the virtual function OnOCRResult.
Python interface
Rename the built wcocr.dll to wcocr.pyd and put it in the same directory as test.py.
You can use the following code to test it:
import wcocr
wcocr.init(wechatocr_path, wechat_path)
result = wcocr.ocr("D:\\test.png")
Currently, the python interface only supports sync mode.
Java interface
- see java/Test.java
- I'm not so familiar with java and don't know how to pass complex data structures, so I just passed a JSON string from cpp to java.
- The added DLL export function
wechat_ocrcan also be used in other scenarios.
C Sharp (C#) interface
- see
c_sharpfolder. - It's important to ensure the built dll is copied to the folder test_cs.exe in! always copy the 64bit version dll!
- It's ok to built a 32bit test_cs.exe and copy the 32bit dll, you can try.
链接
同类插件
liustack/modlens★ 3005
为纯文本模型架起视觉桥梁:粘贴图片,输出结构化 JSON 证据(OCR、版面、语义)。
ysr666/dsh-vision-router★ 714
为纯文本 Agent 提供视觉能力:内置免 Key 视觉链 + 像素级视觉工具(看图问答、定位、裁剪、像素对比、取色、OCR、矢量化、抠图、截图);粘贴图片即可用。
Anionex/dsh-vision-toolkit★ 680
让纯文本模型更好地做视觉任务:带意图的图片问答、长截图 OCR、UI 还原等。
jing-hy/picturereader★ 16
给纯文本模型的"读图"能力:图片降分辨率+降色深+结构/色彩指纹渲染成文本网格喂回对话,模型像多模态一样自主缩放、取样、OCR 读图;纯本地零外部模型依赖,附读图方法论 skill 与可选 PaddleOCR。
linenxi-ctrl/dsh-vision★ 12
外挂识图插件:鲸鱼按钮配置面板、图片识图自动回传、模型自主截图识图工具。
Flyvhidbwo/dsh-vision-proxy★ 11
DeepSeek 大脑 + 自动识图:GUI 附加的每张图片自动经 OpenAI 兼容 VLM 转译成文字,再交给纯文本的 DeepSeek 作答——有 key 自动走快速通道(默认 qwen3.7-flash,支持百炼/智谱/OpenRouter 等任意 OpenAI 兼容端点),无 key 自动探测本地 Ollama(零配置,图片不出本机)。