## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
thomasanna
@thomasanna
Fatal error: Uncaught thiagoalessio\TesseractOCR\FeatureNotAvailableException: Error! Reading image data from stdin is not available this tesseract version Required version is 3.03-rc1, actual version is is Generated command: "tesseract" "" "C:\Users\hp\AppData\Local\Temp\ocr49E1.tmp" in C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php:108 Stack trace: #0 C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\TesseractOCR.php(63): thiagoalessio\TesseractOCR\FriendlyErrors::checkTesseractVersion('3.03-rc1', 'Reading image d...', Object(thiagoalessio\TesseractOCR\Command)) #1 C:\xampp\htdocs\v34\ocr.php(361): thiagoalessio\TesseractOCR\TesseractOCR->imageData('<br />\n<b>Warni...', 148) #2 {main} thrown in C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 108
Akshay Sonawane
@akkiraje212:matrix.org
[m]

code

echo (new TesseractOCR($file_name))->run(); xiaohui @xiaohui96 hello , i am using tesseract-ocr-for-php in win10, and it's version is 3.05.00dev. It works well. However, when i use the api of userWords, it doesn't work, and IDEA reminds me that 'Method 'userWords' not found in thiagoalessio\TesseractOCR\TesseractOCR Reference method is not found in subject class'. can anyone help me, thanks a lot This is the whole code screenshot Tal Lahyani @talah221 method userWords also doesn't exists for me too. also the package not reading all file, what can I do Satyabrata Panigrahi @satyantspl:matrix.org [m] Fatal error: Cannot use thiagoalessio\TesseractOCR\TesseractOCR as TesseractOCR because the name is already in use in C:\xampp\htdocs\test\pdfsearch.php on line 14 i am getting error Harsha-Karbotkar @Harsha-Karbotkar Hi, Getting below error on echo (new TesseractOCR('sample01.jpg')) ->run(); Fatal error: Uncaught exception 'thiagoalessio\TesseractOCR\TesseractNotFoundException' with message 'Error! The command "tesseract" was not found. Make sure you have Tesseract OCR installed on your system: https://github.com/tesseract-ocr/tesseract The current$PATH is C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\xampp\php;D:\xampp;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Harsha\AppData\Local\Microsoft\WindowsApps;C:\Users\Harsha\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Harsha\AppData\Local\Microsoft\WindowsApps;C:\Users\Harsha\AppData\Roaming\Composer\vendor\bin' in C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php:40 Stack trace: #0 C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\TesseractOCR.php(26): thiagoalessio\TesseractOCR\FriendlyErrors::checkTesseractPresence('tesseract') #1 C:\xampp\htdocs\Test\test.php(13 in C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 40

gme777
@gme777
Hi

PHP Fatal error: Uncaught thiagoalessio\TesseractOCR\UnsuccessfulCommandException: Error! The command did not produce any output.

Generated command:
"tesseract" "txtimg.png" "/tmp/ocrg5okNs"

Returned message:
Tesseract Open Source OCR Engine v3.04.01 with Leptonica
Info in pixReadStreamPng: converting (cmap + alpha) ==> RGBA
Error in pixReadStreamPng: spp == 1, cmap, trans array, invalid depth: 4 in /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php:66
Stack trace:

#0 /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/TesseractOCR.php(39): thiagoalessio\TesseractOCR\FriendlyErrors::checkCommandExecution(Object(thiagoalessio\TesseractOCR\Command), '', 'Tesseract Open ...')

#1 /var/www/html/st_scraper/ocr.php(7): thiagoalessio\TesseractOCR\TesseractOCR->run()

#2 {main}

thrown in /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php on line 66

do someone know how i can fix that
the php file:
<?php
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('txtimg.png'))
->run();
igi-1w3r53n
@igi-1w3r53n
Hi, and thank you so much for this great repository! The origin tesseract module / API has a function to crop parts of an image to detect the text in a specific area (api->SetRectangle(30, 86, 590, 100)). Unfortunately, this repository has no function like “SetRectangle” or “setRectangle”. Is there a way to define areas that the tool should read? I need to define multiple parts in an image to create an assignment to the different input values.
Jordan Malan
@JordanMalan
@gme777 It seems the library isn't able to run any commands, do you have tesseract installed? Is it available via your environment's PATH variable?
@igi-iwersen In the past I've used imagick to crop parts of an image then OCR those individual parts, imagick also came in handy when I was converting from PDF to PNG. Perhaps this is something you could try?
@thiagoalessio Hi, I'm not super familiar with tesseract itself but I have used this library in the past (I even fixed a bug a while ago haha) -- I'm wondering if tesseract has the capability to export coordinates of text and if it's possible for me to use or extend the php library to extract those coordinates?
Kaisir Ahmed Oly
@kaisirerp2all
i am new for tesseract-ocr library
i am using this and stuck when upload in cpanel
can you please tell me the process of using this library in cpanel
igi-1w3r53n
@igi-1w3r53n
@JordanMalan thank you. My solution for testing purpose looks like this (I tested with imageick and imagecrop):
public function crop($pRectangle,$pPath, $pFilename,$pMethod = 1)
{
try
{
$srcPath =$pPath . DIRECTORY_SEPARATOR . $pFilename;$targetPath = $pPath . DIRECTORY_SEPARATOR . "demobill_cropped.png"; if ($pMethod == 1)
{
$image = imagecreatefrompng($srcPath);
$cropped = imagecrop($image, $pRectangle); imagepng($cropped, $targetPath); imagedestroy($image);

$ocr = new TesseractOCR($targetPath);
return $ocr->run(); } elseif ($pMethod == 2)
{
if (!$this->imageick) {$this->imageick = new Imagick(realpath($srcPath));$this->bkp = $this->imageick->getImage(); }$img = $this->bkp->clone();$img->cropImage($pRectangle['width'],$pRectangle['height'], $pRectangle['x'],$pRectangle['y']);
$data =$img->getImageBlob();
$size =$img->getImageLength();

$ocr = new TesseractOCR();$ocr->imageData($data,$size);

return $ocr->run(); } } catch (\Exception$e)
{
return \$e->getMessage();
}
}
Michael Bordash
@mbordash
Hi, I see you're using proc_open. I'd like to implement a max execution time function that kills the child unix process in case someone tries to scan a file and consumes too much CPU time. Any chance you have this in the works or know of a good way to handle this?
Jordan Malan
@JordanMalan
@mbordash I spent a few hours learning about processes and pipes, etc.. I made a script that worked. Then I looked at the library to see how I might implement it then found that it already existed :D hahahah
@mbordash You can pass a timeout (in milliseconds?) to run(). See https://github.com/thiagoalessio/tesseract-ocr-for-php#run
Jordan Malan
@JordanMalan
@mbordash I see your activity here and on the repo and I'm getting some context now. I'll do some research tonight and see if I can't reproduce and fix the issue. Can you specify a few more details about your configuration?
Michael Bordash
@mbordash
@JordanMalan HAH! Thank you for those notes, I just realized the author implemented the run(timeout)... so very cool...
thiruna vukkarasr
@thirunabs:matrix.org
[m]
Hi i am new for tesseract-ocr library Object of class thiagoalessio\TesseractOCR\TesseractOCR could not be converted to string .. Please give me solution
Hi i am new for tesseract-ocr. im trying to use in xampp and getting an error like this => Class 'thiagoalessio\TesseractOCR\TesseractOCR' not found in C:\xampp\htdocs\tesseract\index.php
require_once "vendor/autoload.php"; use thiagoalessio\TesseractOCR\TesseractOCR; echo (new TesseractOCR('text.png')) ->run();
this is my index.php file
Matt Humphrey
@m4tthumphrey
Is this active?
Struggling to recognise single characters as a result of cropping the original image using imagecrop (GD)
Jordan Malan
@JordanMalan
@m4tthumphrey It's hit and miss. Could you provide a sample of your image/code? ... Right off the bat this seems like a GD issue or something deeper within tesseract. I'd suggest cropping your image with photoshop (or something similar) and comparing the result with your GD cropped image, perhaps that image will work and you'll have a better idea of how to continue
@thirunabs:matrix.org ... this is not a library issue, I'd guess you may need "composer install" and or "composer dumpautoload"
Rémi Bernard
@remib18
Hello, I need to use OCR in order to get text and its position in the image.
I saw that this is possible with Tesseract (stackOverflow).
So my question, is this possible with this php interface ?
Ashish Budhraja
@ashish-budhraja
How to get text to json?
Romson18
@Romson18
Hi @thiagoalessio
When I upload an image that does not contain text, I get this error. How to control it so as not to have it. Thanks
SeoHyungSan
@Seo-Hyung-San
Hello
SeoHyungSan
@Seo-Hyung-San
Hi, @thiagoalessio
Can you bring information about the letters in the image?