tesseract.js icon indicating copy to clipboard operation
tesseract.js copied to clipboard

Reading Gifs throws an exception: "function signature mismatch"

Open thiagoperes opened this issue 5 years ago • 3 comments

Describe the bug I'm trying to run Tesseract the following way on Node.js:

Tesseract.recognize(url, 'eng').then(({ data: { text } }) => {
    console.log(text);
  });

Everything runs smoothly until I get a gif image (link), which throws the error below:

Error in pixReadMemGif: function not present
Error in pixReadMem: gif: no pix returned
Error in pixGetSpp: pix not defined
Error in pixGetDimensions: pix not defined
Error in pixGetColormap: pix not defined
Error in pixCopy: pixs not defined
Error in pixGetDepth: pix not defined
Error in pixGetWpl: pix not defined
Error in pixGetYRes: pix not defined
Error in pixClone: pixs not defined
Please call SetImage before attempting recognition.
/Users/thiagoperes/house/node_modules/tesseract.js/src/createWorker.js:173
        throw Error(data);
        ^

Error: RuntimeError: function signature mismatch
    at ChildProcess.<anonymous> (/Users/thiagoperes/house/node_modules/tesseract.js/src/createWorker.js:173:15)
    at ChildProcess.emit (events.js:314:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

To Reproduce Steps to reproduce the behavior:

  1. Use Tesseract.js in node
  2. Try requesting a gif image
  3. See error

Expected behavior Detection to work successfully

Screenshots N/A

Desktop (please complete the following information):

  • OS: Mac OS Big Sur 11.0.1
  • Browser N/A
  • tesseract.js@^2.1.4
  • Node Version v12.19.0

Additional context No additional context

thiagoperes avatar Nov 28 '20 19:11 thiagoperes

This happens to me as well intermittently with tiff files.

Error in pixReadMem: Unknown format: no pix returned
Error in pixGetSpp: pix not defined
Error in pixGetDimensions: pix not defined
Error in pixGetColormap: pix not defined
Error in pixCopy: pixs not defined
Error in pixGetDepth: pix not defined
Error in pixGetWpl: pix not defined
Error in pixGetYRes: pix not defined
Error in pixClone: pixs not defined
Please call SetImage before attempting recognition.
C:\Users\jbhan\jsScripts\viewing-tif-king-county-properties\node_modules\tesseract.js\src\createWorker.js:173
        throw Error(data);
        ^

Error: RuntimeError: function signature mismatch
    at ChildProcess.<anonymous> (C:\Users\jbhan\jsScripts\viewing-tif-king-county-properties\node_modules\tesseract.js\src\createWorker.js:173:15)

aarmora avatar Jan 27 '21 15:01 aarmora

I've seen this before while testing a continual OCR read/output loop, the issue there was relating to the time required to create the image vs when tesseract tries to pick up the image to process it. First experienced using bmp files, this was reduced in frequency when using png. Does this still occur if you add a small wait between setting the image and executing the OCR read?

Daiestai avatar Feb 12 '21 08:02 Daiestai

He visto esto antes mientras probaba un bucle continuo de lectura / salida de OCR, el problema estaba relacionado con el tiempo requerido para crear la imagen frente a cuando tesseract intenta tomar la imagen para procesarla. Experimenté por primera vez usando archivos bmp, esto se redujo en frecuencia al usar png. ¿Sigue ocurriendo esto si agrega una pequeña espera entre la configuración de la imagen y la ejecución de la lectura de OCR?

this work for me, I added a setTimeout function with 200 ms

oasis1992 avatar May 31 '21 07:05 oasis1992

I'm closing this issue as I confirmed that .gif files (including the file linked above) are recognized as expected using the current version. I'm adding a .gif test to confirm this does not change in any future version. With regards to the subsequent commenters, the error "Please call SetImage before attempting recognition" is fairly generic, so if you are experiencing this for reasons unrelated to gif compatibility, please open a separate issue.

Balearica avatar Aug 21 '22 01:08 Balearica