GOCR(1)

πŸ“¦
version 0.52 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ‘‘ GOCR(1) β€” User's Manual ✨

okay bestie, pull up a chair, because GOCR(1) is genuinely one of those little tools that just does the thing and I need you to know about it. this is the manual page, but make it make sense. let's go πŸ’…


🌸 NAME 🌸

gocr β€” command line text recognition tool

like, it looks at a picture of text and goes "oh that's letters" and types them out for you. iconic behaviour honestly.


✨ SYNOPSIS ✨

gocr [OPTION] [-i] pnm-file

πŸ’– DESCRIPTION πŸ’–

gocr is an optical character recognition program that you can absolutely just run from the command line, no GUI, no nonsense, no "please sign in to continue". 🫢

It takes input in PNM, PGM, PBM, PPM, or PCX format, and writes the recognized text to stdout. So yes, you can pipe it. yes, that's the whole vibe. πŸ”₯

If the pnm file is a single dash (-), then PNM data is read from stdin instead. classic.

now here's the slay part: if gzip, bzip2 and netpbm are installed and your system supports popen(3), then also pnm.gz, pnm.bz2, png, jpg, jpeg, tiff, gif, bmp, ps (only single pages, so don't come for me with a 400-page PDF) and eps are supported as input files β€” not as an input stream, bestie, files only β€” where pnm can be replaced by one of ppm, pgm and pbm. πŸ’«

πŸŽ€ OPTIONS πŸŽ€

  • -h β€” show usage information
  • -V β€” show version information
  • -i file β€” read input from file (or from stdin if file is a single dash)
  • -o file β€” send output to file instead of stdout
  • -e file β€” send errors to file instead of stderr, or to stdout if file is a dash
  • -x file β€” progress output goes to file (and file can be a file name, a fifo name, or a file descriptor 1...255). this one is genuinely useful for GUI developers who want to show the OCR progress. heads up tho: the file descriptor argument is only available if it was compiled with __USE_POSIX defined πŸ™ˆ
  • -p path β€” database path, and a final slash must be included, default is ./db/. this path will be populated with images of learned characters, so it grows. she's learning. 🧚
  • -f format β€” output format of the recognized text (ISO8859_1, TeX, HTML, XML, UTF8, ASCII). XML will also output position and probability data, which is lowkey the good stuff ✨
  • -l level β€” set grey level to level (0<160<=255, default: 0 for autodetect). darker pixels belong to characters, brighter pixels are interpreted as background of the input image
  • -d size β€” set dust size in pixels (clusters smaller than this are removed), 0 means no clusters are removed, the default is -1 for auto detection
  • -s num β€” set spacewidth between words in units of dots (default: 0 for autodetect). wider widths are interpreted as word spaces, smaller as character spaces
  • -v verbosity β€” be verbose to stderr; verbosity is a bitfield (details below, keep reading πŸ“–)
  • -c string β€” only verbose output of characters from string to stderr. more output is generated for all characters within the string, the underscore stands for unknown chars, and this function is usefull to limit debug information to the necessary one
  • -C string β€” only recognise characters from string. this is a filter function for when you only care about a part of the character alphabet. you can use 0-9 or a-z to specify ranges, and use -- to detect the minus sign
  • -a certainty β€” set value for certainty of recognition (0..100; default: 95). characters with a higher certainty are accepted, characters with a lower certainty are treated as unknown (not recognized). set higher values if you want to have only more certain recognized characters
  • -u string β€” output this string for every unrecognized character (default is "_")
  • -m mode β€” set oprational mode; mode is a bitfield (default: 0)
  • -n bool β€” if bool is non-zero, only recognise numbers. this is now obsolete, use -C "0123456789" instead 🫠

πŸ¦‹ The verbosity is specified as a bitfield: πŸ¦‹

  • 1 β€” print more info
  • 2 β€” list shapes of boxes (see -c) to stderr
  • 4 β€” list pattern of boxes (see -c) to stderr
  • 8 β€” print pattern after recognition for debugging
  • 16 β€” print debug information about recognition of lines to stderr
  • 32 β€” create outXX.png with boxes and lines marked on each general OCR-step

πŸ’œ The operation modes are: πŸ’œ

  • 2 β€” use database to recognize characters which are not recognized by other algorithms, (early development)
  • 4 β€” switching on layout analysis or zoning (development)
  • 8 β€” don't compare unrecognized characters to recognized one
  • 16 β€” don't try to divide overlapping characters to two or three single characters
  • 32 β€” don't do context correction
  • 64 β€” character packing: before recognition starts, similar characters are searched and only one of this characters will be send to the recognition engine (development)
  • 130 β€” extend database, prompts user for unidentified characters and extends the database with users answer (128+2, early development)
  • 256 β€” switch off the recognition engine (makes sense together with -m 2)

🫢 AUTHOR 🫢

Joerg Schulenburg (see http://www-e.uni-magdeburg.de/jschulen/ocr/ for EMAIL)

First version of man page by Tim Waugh <twaugh@redhat.com>


⭐ VERSION INFORMATION ⭐

This man page documents gocr, version 0.52.


🚨 REPORTING BUGS 🚨

Report bugs to Joerg Schulenburg.

no cap, if something's broken, tell the human, not the void. πŸ“£

🌈 SEE ALSO 🌈

More details can be found at /usr/share/doc/gocr-X.XX/gocr.html. Also read /usr/share/doc/gocr-X.XX/README to learn, how to improve results.


πŸ’… EXAMPLES πŸ’…

gocr -v 33 text1.pbm

gocr -v 33 text1.pbm

output verbose information, and out30.png is created so you can see details of the recognition process πŸ‘€


gocr -v 7 -c _YV text1.pbm

gocr -v 7 -c _YV text1.pbm

verbose output for unknown chars and chars Y and V


djpeg -pnm -gray text.jpg | gocr -

djpeg -pnm -gray text.jpg | gocr -

convert a jpeg file to pnm format and input via pipe. pipe girlies stay winning πŸ“


and that's the whole page, bestie!! this one lives on Linux, dated 20 Sep 2018, and it's the manual page for GOCR(1). go read some pixels. mwah πŸ’–βœ¨