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

Add support for ImageData and fix a hang in buffer handling

Open WintrySnowman opened this issue 4 years ago • 0 comments

Addresses two concerns:

  1. The setImage() function started to hang for a long period of time (several seconds for a 1080p image, for example) trying to handle the buffer. I don't quite know why the code was written as it was originally, but changing that one line has stopped it hanging.
  2. Adds support for the ImageData obtained from canvases. This improves performance by allowing you to bypass toBlob()/toDataURL() (which would convert to a PNG first), if that's the data format you already have.

WintrySnowman avatar Apr 22 '22 23:04 WintrySnowman

Thanks for this contribution. I agree that it makes sense to pass ImageData directly rather than converting to .png.

Balearica avatar Aug 11 '22 04:08 Balearica

This had to be reverted as it does not run on Node. 100% my fault for not checking first, however in the future please run the automated tests before making a PR (npm run test).

Balearica avatar Aug 11 '22 05:08 Balearica