Skip to main content

Image Cropping | Flutter Document Scanner

The Scanbot SDK provides the ability to crop, rotate and perform perspective correction on the source images.

The Image cropping functionality is available both as an RTU-UI and as a classic component.

RTU-UI Component

The Ready-To-Use UI (RTU-UI) Components offer a collection of customizable, high-level UI components designed for common tasks. These components are easy to integrate and are based on our extensive experience and valuable feedback from our SDK customers.

The Cropping UI enables users to manually crop and rotate images. It leverages the edge detection algorithm from the Scanbot SDK and includes intuitive features like magnetic lines and a magnifier for precise adjustments.

alt

lib/doc_code_sinppet/document_sdk/cropping_screen_snippet.dart
loading...
  • result is an instance of CroppingResult.

CroppingResult

The result class that returns a cropped page from the Cropping RTU UI component.

CroppingScreenConfiguration

The cropping UI requires a page object. A page object can be initially created using the Document Scanner, createPage() or createPageWithImageBytes().

Classic Component

Integration of Cropping Components

Use the ScanbotCroppingWidget and CroppingController classes to integrate and customize the Cropping Classic Component for handling page objects within your app.

Quick Start Guide

Here's how you can integrate ScanbotCroppingWidget into your widget tree:

CroppingController? croppingController;

ScanbotCroppingWidget(
page: page, // Page object to be cropped
onViewReady: (controller) {
// Callback when the cropping view is ready
croppingController = controller;
},
onHeavyOperationProcessing: (isProcessing) {
// Callback for handling long processing operations
},
edgeColor: Colors.red, // Color of the cropping edges
edgeColorOnLine: Colors.blue, // Color when edges are on the line
anchorPointsColor: Colors.amberAccent, // Color of anchor points
borderInsets: sdk.Insets.all(16), // Insets for the cropping borders
)

ScanbotCroppingWidget

CroppingController

For a fully functional example, please see our example app scanbot-sdk-example-flutter on GitHub.

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top