Browse Source

Clarified image format documentation per #359 (#670)

pull/671/head
Balearica 3 years ago committed by GitHub
parent
commit
c9200839df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      docs/image-format.md

25
docs/image-format.md

@ -1,17 +1,18 @@
# Image Format # Image Format
Support Format: **bmp, jpg, png, pbm** The main Tesseract.js functions (ex. recognize, detect) take an `image` parameter. The image formats and data types supported are listed below.
The main Tesseract.js functions (ex. recognize, detect) 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. Support Image Formats: **bmp, jpg, png, pbm, webp**
On a browser, an image can be: For browser and Node, supported data types are:
- an `img` or `canvas` element - string with base64 encoded image (fits `data:image\/([a-zA-Z]*);base64,([^"]*)` regexp)
- a `File` object (from a file `<input>`) - buffer
- a `Blob` object
- a path or URL to an accessible image
- a base64 encoded image fits `data:image\/([a-zA-Z]*);base64,([^"]*)` regexp
In Node.js, an image can be For browser only, supported data types are:
- a path to a local image - `File` or `Blob` object
- a Buffer storing binary image - `img` or `canvas` element
- a base64 encoded image fits `data:image\/([a-zA-Z]*);base64,([^"]*)` regexp
For Node only, supported data types are:
- string containing a path to local image
Note: images must be a supported image format **and** a supported data type. For example, a buffer containing a png image is supported. A buffer containing raw pixel data is not supported.
Loading…
Cancel
Save