Skip to main content

Quality Analyzer | Web Document Scanner

The Scanbot SDK Document Quality Analyzer API allows you to determine the quality of text in an image. The result is a string type where EXCELLENT is the best text quality in an image and VERY_POOR is the worst text quality in an image. It is used to determine if the document is good enough to be used for OCR processing.

createDocumentQualityAnalyzer(config?: DocumentQualityAnalyzerConfig): Promise<DocumentQualityAnalyzer>

See DocumentQualityAnalyzerConfig for a list of available configuration options.

async analyze(imageData: ArrayBuffer): Promise<DocumentQualityAnalyzerResult>

Result object:

interface DocumentQualityAnalyzerResult {
quality: "NO_DOCUMENT" | "VERY_POOR" | "POOR" | "REASONABLE" | "GOOD" | "EXCELLENT";
}

Always release the analyzer object after it is no longer needed

async release(): Promise<void>

Example usage:

async function onDocumentDetected(e) {
const analyzer = await scanbotSDK.createDocumentQualityAnalyzer({ maxImageSize: 2000 });
const result = await analyzer.analyze(e.cropped);
console.log('analysis', result);
await analyzer.release();
}

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?