New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Canvas Support for Node #649
Comments
We do not actually have any meaningful canvas integration for browser (i.e. we don't read the canvas data directly). Rather, we simply call the
|
Thanks for that context. I guess the ask then is to support an
|
I agree that supporting raw A note for any future developers: versions 2 and 3 both had a major memory leak due to (presumably incorrectly) passing arrays directly from JavaScript to Webassembly (#678). I was not able to figure out why in a reasonable amount of time, so instead switched to writing images to the (virtual) Webassembly filesystem and having Tesseract read them from (virtual) disk in v4. Any future version that passes image data directly would need to figure out how to pass data directly and not cause memory leaks. I would also advise benchmarking to see how much time writing/reading the |
I've started a PR #726 which is related to this. It doesn't directly address Node.js support, but it improves performance by avoiding PNG encoding as @GICodeWarrior suggested. It still uses |
Is your feature request related to a problem? Please describe.
I'm using some code both in the browser and in Node.js (using node-canvas), and I get an error when I try to pass a canvas to recognize in node.
Describe the solution you'd like
Please consider implementing support for canvas in node. The node-canvas implementation largely matches the browser API.
https://github.com/Automattic/node-canvas
Describe alternatives you've considered
It would be helpful to return a clearer error message when an unsupported type is provided to recognize.
In the meantime, I can write some code to detect running in node and convert the canvas before recognition.
Additional context
The errors I get when trying to use canvas with tesseract.js in node are below:
The text was updated successfully, but these errors were encountered: