GOCR(1)
π 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: ifgzip,bzip2andnetpbmare installed and your system supportspopen(3), then alsopnm.gz,pnm.bz2,png,jpg,jpeg,tiff,gif,bmp,ps(only single pages, so don't come for me with a 400-page PDF) andepsare supported as input files β not as an input stream, bestie, files only β wherepnmcan be replaced by one ofppm,pgmandpbm. π«
π OPTIONS π
-hβ show usage information-Vβ show version information-i fileβ read input from file (or fromstdinif file is a single dash)-o fileβ send output to file instead ofstdout-e fileβ send errors to file instead ofstderr, or tostdoutif file is a dash-x fileβ progress output goes to file (and file can be a file name, a fifo name, or a file descriptor1...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_POSIXdefined π-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).XMLwill also output position and probability data, which is lowkey the good stuff β¨-l levelβ set grey level to level (0<160<=255, default:0for 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),0means no clusters are removed, the default is-1for auto detection-s numβ set spacewidth between words in units of dots (default:0for autodetect). wider widths are interpreted as word spaces, smaller as character spaces-v verbosityβ be verbose tostderr; verbosity is a bitfield (details below, keep reading π)-c stringβ only verbose output of characters from string tostderr. 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 use0-9ora-zto 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 info2β list shapes of boxes (see-c) tostderr4β list pattern of boxes (see-c) tostderr8β print pattern after recognition for debugging16β print debug information about recognition of lines tostderr32β createoutXX.pngwith 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 one16β don't try to divide overlapping characters to two or three single characters32β don't do context correction64β 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 πβ¨
π¦ where this page comes from
- debian bookworm: gocr 0.52-6 Β· GPL-2.0-or-later
- debian trixie: gocr 0.52-6.1+b1 Β· GPL-2.0-or-later
- ubuntu jammy: gocr 0.52-3 Β· GPL-2.0-or-later
- ubuntu noble: gocr 0.52-6.1build1 Β· GPL-2.0-or-later
- ubuntu questing: gocr 0.52-6.1build1
- ubuntu resolute: gocr 0.52-6.1build2 Β· GPL-2.0-or-later
- ubuntu stonking: gocr 0.52-6.1build2 Β· GPL-2.0-or-later
- Copyright 2000 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms