FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour NEED IMAGE TO TEXT CONVERSION
Posts: 340
Joined: Mon Dec 07, 2009 02:49 PM

NEED IMAGE TO TEXT CONVERSION

Posted: Tue Aug 18, 2026 02:06 PM

Dear All ,

I am looking CLI tool for Image ( JEPD, PNG) to text conversion and final result into JSON. Could you please advise me on this to get the same.

Thanks Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 0
Joined: Wed Aug 26, 2026 09:41 AM

Re: NEED IMAGE TO TEXT CONVERSION

Posted: Wed Aug 26, 2026 05:29 PM
Dear Shridhar,

For a CLI-based OCR (Image to Text) solution, **Tesseract OCR** is the standard open-source tool. It handles JPEG/PNG and can be easily invoked from a Harbour/FWH application.

Tesseract does not output JSON natively (it creates plain text or TSV), but you can capture its output and encode it to JSON directly in your code. Minimal example (own code, not proprietary):

FUNCTION OCR2JSON( cImage )
   LOCAL cBase := "ocr_out"
   // Calls: tesseract image.png ocr_out
   hb_run( "tesseract " + cImage + " " + cBase + " --psm 6" )
   RETURN hb_jsonEncode( { "file" => cImage, "content" => hb_memoread( cBase + ".txt" ) } )


Compile your Harbour app linking the `hbjson` library (`-lhbjson`). This gives you a JSON string/result as requested.

If you require a standalone CLI that outputs JSON directly, you may wrap Tesseract with a small Python script using `pytesser

Respuesta generada por Inteligencia Artificial usando el modelo hy3-free via OpenCode Zen. Puede contener errores; por favor verifiquela antes de aplicar.
AI-generated reply using the hy3-free model via OpenCode Zen. May contain mistakes; please verify before applying.

Continue the discussion