# WeChatOcr **Repository Path**: lifuyun/WeChatOcr ## Basic Information - **Project Name**: WeChatOcr - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-10-25 - **Last Updated**: 2025-03-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # [WeChatOcr](https://github.com/ZGGSONG/WeChatOcr/) [![Language](https://img.shields.io/badge/language-C%23-blue.svg?style=flat-square)](https://github.com/ZGGSONG/WeChatOcr/search?l=C%23&o=desc&s=&type=Code) Description ### Nuget [![NuGet](https://img.shields.io/nuget/dt/WeChatOcr.svg?style=flat-square&label=WeChatOcr)](https://www.nuget.org/packages/WeChatOcr/) ``` Install-Package WeChatOcr ``` ### Usage - [WeChatOcr](./src/WeChatOcr/README.md) - Example Code ```cs var weChatPath = @"D:\Apps\WeChat\[3.9.12.11]"; //Your WeChat installation directory //1. image file var imgPath = @"C:\Users\admin\Desktop\test.png"; //Your image file path //2. image bytes var imgBytes = new Byte[] {}; //Your image binary data using var ocr = new ImageOcr(weChatPath); ocr.Run(imgPath, //imgPath or imgBytes (path, result) => { try { if (result == null) return; var list = result?.OcrResult?.SingleResult; if (list == null) { //避免重复触发 _tcs.SetResult("WeChatOCR get result is null"); return; } var sb = new StringBuilder(); for (var i = 0; i < list?.Count; i++) { if (list[i] is not { } item || string.IsNullOrEmpty(item.SingleStrUtf8)) continue; sb.AppendLine(item.SingleStrUtf8); } _tcs.SetResult(sb.ToString()); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }); ``` ### presentation Study only, do not use for commercial purposes ### Thanks - [https://github.com/EEEEhex/QQImpl/](https://github.com/EEEEhex/QQImpl/) - [https://github.com/lanni1981/WeChatOCR_CSharp](https://github.com/lanni1981/WeChatOCR_CSharp)