// if we know our image is of spanish words without the letter 'e':
// if we know our image is of spanish words without the letter 'e':
Tesseract.recognize(myImage, {
Tesseract.recognize(myImage, {
lang: 'spa',
langs: 'spa',
tessedit_char_blacklist: 'e'
tessedit_char_blacklist: 'e'
})
})
.then(function(result){
.then(function(result){
@ -137,22 +137,13 @@ Tesseract.detect(myImage)
The main Tesseract.js functions take an `image` parameter, which should be something that is like an image. What's considered "image-like" differs depending on whether it is being run from the browser or through NodeJS.
The main Tesseract.js functions take an `image` parameter, which should be something that is like an image. What's considered "image-like" differs depending on whether it is being run from the browser or through NodeJS.
On a browser, an image can be:
On a browser, an image can be:
- an `img`, `video`, or `canvas` element
- an `img`, `video`, or `canvas` element
- a CanvasRenderingContext2D (returned by `canvas.getContext('2d')`)
- a `File` object (from a file `<input>` or drag-drop event)
- a `File` object (from a file `<input>` or drag-drop event)
- a `Blob` object
- a path or URL to an accessible image (the image must either be hosted locally)
- a `ImageData` instance (an object containing `width`, `height` and `data` properties)
- a path or URL to an accessible image (the image must either be hosted locally or accessible by CORS)
In Node.js, an image can be
In Node.js, an image can be
- a path to a local image
- a path to a local image
- a `Buffer` instance containing a `PNG` or `JPEG` image
- a `ImageData` instance (an object containing `width`, `height` and `data` properties)
constTESTOCR_TEXT='This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. The quick brown dog jumped\nover the lazy fox. The quick brown dog\njumped over the lazy fox. The quick\nbrown dog jumped over the lazy fox.\n';
constTESTOCR_TEXT='This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. The quick brown dog jumped\nover the lazy fox. The quick brown dog\njumped over the lazy fox. The quick\nbrown dog jumped over the lazy fox.\n';