First grab copies of `tesseract.js` and `tesseract.worker.js` from the [dist folder](https://github.com/naptha/tesseract.js/tree/master/dist). Then include `tesseract.js` on your page like this:
First grab copies of `tesseract.js` and `tesseract.worker.js` from the [dist folder](https://github.com/naptha/tesseract.js/tree/master/dist). Then include `tesseract.js` on your page, and set `Tesseract.workerUrl` like this:
```html
```html
<scriptsrc='/path/to/tesseract.js'></script>
<scriptsrc='/path/to/tesseract.js'></script>
<script>
<script>
var worker = createTesseractWorker('/path/to/tesseract.worker.js')
Returns a TesseractJob whose `then` method can be used to act on the result of the OCR.
For example:
## ImageLike
The main Tesseract.js functions take an `image` parameter, which should be something that is 'image-like'.
`image` can be
That means `image` should be
- an `img` element or querySelector that matches an `img` element
- an `img` element or querySelector that matches an `img` element
- a `video` element or querySelector that matches a `video` element
- a `video` element or querySelector that matches a `video` element
- a `canvas` element or querySelector that matches a `canvas` element
- a `canvas` element or querySelector that matches a `canvas` element
- a CanvasRenderingContext2D (returned by `canvas.getContext('2d')`)
- a CanvasRenderingContext2D (returned by `canvas.getContext('2d')`)
- the absolute `url` of an image from the same website that is running your script. Browser security policies don't allow access to the content of images from other websites :(
- the absolute `url` of an image from the same website that is running your script. Browser security policies don't allow access to the content of images from other websites :(
Figures out what script (e.g. 'Latin', 'Chinese') the words in the image are written in.
`image` should be an [ImageLike](#imagelike) object.
Returns a [TesseractJob](#tesseractjob) whose `then` method can be used to act on the result of the script.
```javascript
Tesseract.detect('#my-image')
.then(function(result){
console.log(result)
})
```
`image` can be
- an `img` element or querySelector that matches an `img` element
- a `video` element or querySelector that matches a `video` element
- a `canvas` element or querySelector that matches a `canvas` element
- a CanvasRenderingContext2D (returned by `canvas.getContext('2d')`)
- the absolute `url` of an image from the same website that is running your script. Browser security policies don't allow access to the content of images from other websites :(
## TesseractJob
## TesseractJob
A TesseractJob is an an object returned by a call to recognize or detect.
A TesseractJob is an an object returned by a call to recognize or detect.