Skip to main content

Scanning text from an image file with the Capacitor OCR Module

Running OCR on arbitrary images​

You can run OCR on arbitrary image files (JPG or PNG) provided as file URIs:

Perform OCR
loading...

OCR results​

The OCR result contains the recognized plain text as well as the bounding boxes and text results of recognized blocks (paragraphs), lines and words:

{
"recognizedText": "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit.",
"pages": [{
"_type": "Page",
"text": "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit.",
"confidence": 0.9996116757392883,
"roi": [{"x": 88, "y": 88}, {"x": 1048, "y": 88}, {"x": 1048, "y": 224}, {"x": 88, "y": 224}],
"blocks": [{
"_type": "Block",
"text": "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit.",
"confidence": 0.9996116757392883,
"roi": [{"x": 88, "y": 88.00001}, {"x": 1048, "y": 88.00001}, {"x": 1048, "y": 224}, {"x": 88, "y": 224}],
"lines": [{
"_type": "Line",
"text": "Lorem ipsum dolor sit amet, consectetur",
"confidence": 0.9994030594825745,
"roi": [{"x": 88, "y": 88}, {"x": 1048, "y": 88}, {"x": 1048, "y": 136}, {"x": 88, "y": 136}],
"words": [{
"_type": "Word",
"text": "Lorem",
"confidence": 0.9997448325157166,
"roi": [{"x": 88, "y": 88}, {"x": 222.4, "y": 88}, {"x": 222.4, "y": 136}, {"x": 88, "y": 136}],
"glyphs": [{
"_type": "Glyph",
"text": "L",
"confidence": 0.9999779462814331,
"roi": [{"x": 88, "y": 88}, {"x": 112, "y": 88}, {"x": 112, "y": 136}, {"x": 88, "y": 136}]
}
// ...
]
}
// ...
]
}
// ...
]
}
// ...
]
}
// ...
]
}

Want to scan longer than one minute?

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

Get free trial license