Skip to main content

Scanning a Document from an Image | React Native Document Scanner

Document Detection

ScanbotSDK.detectDocument(imageFileUri: string): Promise

The Scanbot SDK uses digital image processing algorithms to find rectangular, document like, polygons in a digital image. This function applies edge dectection and processes all image operations in a background thread. There will be no UI started. As input, a file URI of an image must be passed. The output contains the Detection Result as a string and on success the cropped and perspective corrected image as a new file as well as the detected polygon. If there was no document detected the result enum provides the exact reason (noisy background, too dark, etc). The input image file will not be modified.


Returns object with the following fields

  • documentImageFileUri - File URI of the detected and cropped/warped document image as JPEG ('file:///...'). May be null if detection was not successful.
  • polygon - Contains the detected polygon as an array. May be empty if detection was not successful.
  • detectionResult - The detection status:
/** Detection Status */
export type DetectionStatus =
/** An acceptable polygon was detected. */
| 'OK'
/** A polygon was detected, but its size is too small. */
/** A polygon was detected, but it has too much perspective distortion. */
/** A polygon was detected, but its aspect ratio should be landscape/portrait but is portrait/landscape. */
/** No polygon detected at all. */
/** No polygon detected, image too dark. */
/** No polygon detected, image too noisy (background). */

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?

On this page

Scroll to top