run([ $bin, $imagePath, 'stdout', '-l', $langs, '--psm', '6', ]); if (! $result->successful()) { Log::channel('stack')->warning('tesseract ocr failed', [ 'path' => $imagePath, 'error' => mb_substr($result->errorOutput() ?: $result->output(), 0, 500), ]); return ''; } return trim($result->output()); } }