Scan, enhance, and OCR
Turn paper into usable data by capturing and applying local enhancement first, then extracting text or producing an OCR document. “Scan then OCR” here means sequential tool calls by an agent or script, not a new all-in-one operation.
Describe the result you need
Please scan this document as JPG, check available local deskew enhancement, then extract text from the processed image and retain the original recognition result. Tell me when to place or turn a page.
For multipage export, add: “After all scanning is finished, export a searchable PDF in page order.” These tasks map to czur-document-scan, czur-document-process, and czur-file-ocr. See Install CZUR Skills.
Decide whether you need text, text coordinates, or document files first. Avoid unnecessary exports just to read a short passage. For existing images, skip device operations, perform any needed image processing, and continue to OCR.
Discover capabilities before attaching enhancement
Before starting a scan, discover enhancement capabilities and select an actual device with device.list:
{
"name": "image.enhance_capabilities",
"arguments": {}
}Inspect rotate availability, description, and defaults / schema. This minimal example uses service defaults without specifying an angle. Run it only if the capability is available and its default behavior suits the material. Omit pipeline when enhancement is unnecessary; OCR does not require adding processing steps.
{
"name": "scan.start",
"arguments": {
"device_id": "YOUR_DEVICE_ID",
"page_processing": "single_page",
"color_mode": "auto_optimize",
"format": "jpg",
"pipeline": {
"version": "image.enhance.pipeline.v1",
"steps": [
{
"type": "rotate",
"enabled": true,
"on_error": "fail"
}
],
"target": {
"type": "images",
"export_type": "single-page"
}
}
}
}Paper, color, and enhancement processing run in that order, directly delivering final capture images without downloading and reuploading for enhancement. Capture pipelines accept single-page image targets only. Set the image format with scan.start.format, not PDF/OFD, quality, or Runtime filesystem fields inside the pipeline.
Once the material is ready, capture with the returned scan ID:
{
"name": "scan.capture",
"arguments": {
"scan_id": "RETURNED_SCAN_ID",
"timeout_ms": 60000
}
}Retain every images[].local_path in order. For multiple pages, capture again after each page-turn confirmation. Read and preserve warnings. Failed enhancement must not silently return the original image as success; explicitly skipped steps are not completed steps. Finish scanning before proceeding:
{
"name": "scan.finish",
"arguments": {
"scan_id": "RETURNED_SCAN_ID"
}
}Confirm the session has ended before choosing an independent OCR operation below. Do not submit OCR or independent enhancement while the scan remains active.
When you only need text
Replace the path with an actual returned image path, not a filename inferred from this example:
{
"name": "ocr.extract_text",
"arguments": {
"input_path": "/ABSOLUTE/PATH/TO/RETURNED_PAGE_1.jpg"
}
}text contains full text, blocks follows service block order, and recognized describes recognition. Optional dimensions and block coordinates refer to this enhanced input image, not directly to its unprocessed source. Empty text or blocks can be a valid result and should not automatically trigger recapture or recognition retries.
When you need an OCR document
Supply images in actual page order. For one image, keep just one array entry:
{
"name": "ocr.recognize",
"arguments": {
"input_paths": [
"/ABSOLUTE/PATH/TO/RETURNED_PAGE_1.jpg",
"/ABSOLUTE/PATH/TO/RETURNED_PAGE_2.jpg"
],
"format": "pdf",
"export_type": "multi-page"
}
}Query using the returned handle, not task_id:
{
"name": "ocr.get",
"arguments": {
"handle": "RETURNED_OCR_HANDLE"
}
}For nonterminal states, keep the same handle and query at intervals, such as every 2 seconds, with a bounded overall budget such as 5 minutes. A successful terminal get downloads outputs. Read assets[].local_path, file_uri, content_type, size, and warnings. Terminal handling releases the handle; do not query it again. A failed download is not successful file delivery.
If the user cancels or the wait budget is exceeded, request:
{
"name": "ocr.cancel",
"arguments": {
"handle": "RETURNED_OCR_HANDLE"
}
}Cancellation needs the original, still-valid handle. cancel_requested does not mean cancel_confirmed. If unconfirmed, continue querying within the budget; otherwise report the unknown outcome without automatically starting another task. See long-running tasks and result files.
Step-by-step CLI operations
Inspect capabilities first, save this configuration as scan-pipeline.json, and confirm the defaults suit your material:
{
"version": "image.enhance.pipeline.v1",
"steps": [
{
"type": "rotate",
"enabled": true,
"on_error": "fail"
}
],
"target": {
"type": "images",
"export_type": "single-page"
}
}czur-open image enhance-capabilities --json
czur-open scan "YOUR_DEVICE_ID" --pipeline "./scan-pipeline.json" --format jpg --capture-timeout 60000 --output-dir "./scans" --jsonCheck the scan exit code and status, then read every actual image from files[].path. CLI scanning attempts resource release before exiting. Next choose extraction or document export; running both is unnecessary:
czur-open ocr extract-text "/ABSOLUTE/PATH/TO/RETURNED_PAGE_1.jpg" --json
czur-open ocr recognize "/ABSOLUTE/PATH/TO/RETURNED_PAGE_1.jpg" "/ABSOLUTE/PATH/TO/RETURNED_PAGE_2.jpg" --format pdf --export-type multi-page --output-dir "./documents" --task-timeout 600000 --jsonReplace path placeholders with scan results. --capture-timeout controls capture waiting; --task-timeout controls OCR task waiting. Neither is interchangeable with per-request --timeout. For automatic path handling, see the complete Python automation example.
Review delivered results
Open images to check direction, edges, and readability. Open an OCR PDF and search/copy sample text, checking page order; a filename or extension alone does not establish a text layer. After delivery errors, unknown outcomes, or disconnection, inspect existing files and diagnostics rather than automatically resubmitting.
This workflow uses explicitly selected processing steps only. Check whether OCR and subsequent AI services need networking; see privacy and security. To retain this enhancement setup, continue to save and reuse workflows.