using Serwer.Core.Domain; using Serwer.Infrastructure.Settings; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tesseract; namespace Serwer.Infrastructure.Services { public class ImageHandler : IImageHandler { private readonly ISet _files = new HashSet(); private readonly string _env; public ImageHandler(IHostEnviroment hostEnviroment) { _env = hostEnviroment.RootPath; } public async Task Process(string name, string contentType, byte[] bytes) { var engine = new TesseractEngine(System.IO.Path.Combine(_env, "tessdata"),"eng+equ", EngineMode.Default); var img = Pix.LoadFromMemory(bytes); var res = engine.Process(img); var txt = res.GetText(); return await Task.FromResult(txt); } } }