Skip to main content

Filters And Image Processing | Flutter Document Scanner

Page Operations

ScanbotSdk.createPage(originalImageFileUri, shouldDetectDocument)

Creates a page object from an image. If the encryption parameters are set during the SDK initialization, then the page's images will be stored encrypted with given parameters.

Uri originalImageFileUri = ... // "file:///some/image.jpg"
var page = await ScanbotSdk.createPage(originalImageFileUri, true);
Options:
  • originalImageFileUri - the file URI of the original image to create a page and optionally run document detection on.
  • shouldDetectDocument - flag to specify whether the auto document detection should be performed and the (cropped) DOCUMENT image should be created.

ScanbotSdk.createPageWithImageBytes(imageBytes, shouldDetectDocument)

Creates a page object from image bytes. If the encryption parameters are set during the SDK initialization, then the page's images will be stored encrypted with given parameters.

Uint8List imageBytes = [...]
var page = await ScanbotSdk.createPageWithImageBytes(originalImageFileUri, true);
Options:
  • imageBytes - the image bytes to create a page and optionally run document detection on.
  • shouldDetectDocument - flag to specify whether the auto document detection should be performed and the (cropped) DOCUMENT image should be created.

ScanbotSdk.detectDocument(page)

Runs document detection on the original image of the given page. The detection status, polygon and cropped document image are returned as a new page object.

var updatedPage = await ScanbotSdk.detectDocument(page);
Options:
  • options.page - a valid page object with an original image to process.

ScanbotSdk.applyImageFilter(page, filter)

Applies an image filter on the cropped DOCUMENT image of a page.

var updatedPage = await ScanbotSdk.applyImageFilter(page, ImageFilterType.LOW_LIGHT_BINARIZATION_2);
Options:
  • page - a valid page object with a DOCUMENT image.
  • filter - the image filter to apply. The special value NONE will remove any previously applied filter from the document image.

ScanbotSdk.getFilteredDocumentPreviewUri(page, filter)

Creates a preview image file of the DOCUMENT image by given image filter. Please note that this method does not modify the actual hi-res DOCUMENT image of the passed page object. Use the applyImageFilter(page, filter) method to finally apply an image filter on the hi-res DOCUMENT image of a page.

var previewImageFileUri = await ScanbotSdk.getFilteredDocumentPreviewUri(page, ImageFilterType.BINARIZED);
// use previewImageFileUri to display a preview/thumbnail image
Options:
  • page - the page for which to create a filtered document preview.
  • filter - the image filter to apply on the preview image. The special value NONE will remove any previously applied filter from the document image.

ScanbotSdk.rotatePageClockwise(page, rotationsCount)

Rotates a page clockwise in increments of 90 degrees.

var updatedPage = await ScanbotSdk.rotatePageClockwise(page, 2);
Options:
  • page - the page to rotate.
  • rotationsCount - the number of clockwise 90 degree rotations to apply.

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