TESSERACT(1)
๐ TESSERACT(1) โ the OCR engine that eats and leaves no crumbs
okay bestie so you've wandered into the tesseract manual page and honestly? iconic. this is the command-line OCR engine, and in this house "OCR" means optical character recognition โ you feed it an image and it hands you back the actual text. it's giving "i can read your screenshots." ๐
โจ NAME โจ
tesseract โ the command-line OCR engine. that's the whole name section, we're literally at the door, come in ๐ซถ
๐ธ SYNOPSIS ๐ธ
tesseract FILE OUTPUTBASE [OPTIONS]... [CONFIGFILE]...
like that's it. that's the shape of your whole life with this tool. FILE goes in, OUTPUTBASE comes out, and everything in between is your options and config files doing their little thing โจ
๐ฆ DESCRIPTION ๐ฆ
okay so the lore is actually kind of unhinged: tesseract(1) is a commercial quality OCR engine that was originally developed at HP between 1985 and 1995. 1985!! your parents were probably not even speaking yet ๐ญ
in 1995, this engine was among the top 3 evaluated by UNLV. yes, top three. the way it was out there competing in 1995 being evaluated and everything.
then it was open-sourced by HP and UNLV in 2005, and it's been developed at Google until 2018. so the rรฉsumรฉ is: HP โก๏ธ UNLV โก๏ธ open source โก๏ธ Google. that's a main character career arc, no cap ๐
๐ IN/OUT ARGUMENTS ๐
๐ฅ FILE
the name of the input file. and here's the tea, it can be either an image file or a text file โ flexible queen behavior ๐
- most image file formats are supported โ basically anything readable by Leptonica.
- if it's a text file, that file lists the names of all input images โ one image name per line. and then the results will be combined in a single file for each output file format (
txt,pdf,hocr,xml). batch mode, we love to see it โจ - if
FILEisstdinor-then the standard input is used. keyed in from the void, iykyk ๐
๐ค OUTPUTBASE
the basename of the output file โ like, the stem, and the appropriate extension gets appended to it. by default the output will be a text file with .txt added to the basename, unless there are one or more parameters set which explicitly specify the desired output. so if you asked for something specific, you get that specific something. periodt
if OUTPUTBASE is stdout or - then the standard output is used ๐ (in the good way, where it just prints at you)
โญ OPTIONS โญ
-c CONFIGVAR=VALUEโ set the value for parameterCONFIGVARtoVALUE. and you can stack em! multiple-carguments are allowed. more-c, more power ๐ซถ--dpi Nโ specify the resolutionNin DPI for the input image(s). a typical value forNis300. without this option, the resolution is read from the metadata included in the image. and if an image does not include that information, Tesseract tries to guess it ๐ (it's doing its best, okay)-l LANG,-l SCRIPTโ the language or script to use. if none is specified,eng(English) is assumed. multiple languages may be specified, separated by plus characters (+). Tesseract uses 3-character ISO 639-2 language codes โ see the LANGUAGES AND SCRIPTS section below, that's where the full list lives ๐--psm Nโ set Tesseract to only run a subset of layout analysis and assume a certain form of image. literally you're telling it "bestie don't overthink this, it's one line of text." the options forNare:
0 = Orientation and script detection (OSD) only.
1 = Automatic page segmentation with OSD.
2 = Automatic page segmentation, but no OSD, or OCR. (not implemented)
3 = Fully automatic page segmentation, but no OSD. (Default)
4 = Assume a single column of text of variable sizes.
5 = Assume a single uniform block of vertically aligned text.
6 = Assume a single uniform block of text.
7 = Treat the image as a single text line.
8 = Treat the image as a single word.
9 = Treat the image as a single word in a circle.
10 = Treat the image as a single character.
11 = Sparse text. Find as much text as possible in no particular order.
12 = Sparse text with OSD.
13 = Raw line. Treat the image as a single text line,
bypassing hacks that are Tesseract-specific.
note that 2 is literally marked "(not implemented)". it's a vibe, not a feature ๐
--oem Nโ specify OCR Engine mode. the options forNare:
0 = Original Tesseract only.
1 = Neural nets LSTM only.
2 = Tesseract + LSTM.
3 = Default, based on what is available.
--tessdata-dir PATHโ specify the location of the tessdata path. tell it where the brain lives ๐ง--user-patterns FILEโ specify the location of the user patterns file.--user-words FILEโ specify the location of the user words file.
๐ง CONFIGFILE
the name of a config to use. the name can be:
- a file in
tessdata/configsortessdata/tessconfigs, or - an absolute or relative file path.
a config is a plain text file which contains a list of parameters and their values, one per line, with a space separating parameter from value. simple. clean. aesthetic โจ
interesting config files include:
altoโ output in ALTO format (OUTPUTBASE.xml).hocrโ output in hOCR format (OUTPUTBASE.hocr).pageโ output in PAGE format (OUTPUTBASE.page.xml). the output can be customized with the flags:page_xml_polygonโ create polygons instead of bounding boxes (default:true)page_xml_levelโ create the PAGE file on0=linelevelor1=wordlevel(default:0)
pdfโ output PDF (OUTPUTBASE.pdf).tsvโ output TSV (OUTPUTBASE.tsv).txtโ output plain text (OUTPUTBASE.txt).get.imagesโ write processed input images to file (OUTPUTBASE.processedPAGENUMBER.tif).logfileโ redirect debug messages to file (tesseract.log).lstm.trainโ output files used by LSTM training (OUTPUTBASE.lstmf).makeboxโ write box file (OUTPUTBASE.box).quietโ redirect debug messages to/dev/null. shhh ๐คซ
it is possible to select several config files, for example:
tesseract image.png demo alto hocr pdf txt
will create four output files โ demo.alto, demo.hocr, demo.pdf and demo.txt โ with the OCR results. four files, one command. multitasking icon behavior ๐
Nota bene: the options-l LANG,-l SCRIPTand--psm Nmust occur before anyCONFIGFILE. like, order matters, bestie. put them first or the whole thing gets weird. this is not a drill ๐จ
๐ SINGLE OPTIONS ๐
these are the solo acts, the one-and-done flags:
-h,--helpโ show help message.--help-extraโ show extra help for advanced users. for the girlies who want more.--help-psmโ show page segmentation modes.--help-oemโ show OCR Engine modes.-v,--versionโ returns the current version of thetesseract(1)executable.--list-langsโ list available languages for the tesseract engine. can be used with--tessdata-dir PATH. very much a "what do i actually have installed" vibe check ๐--print-parametersโ print tesseract parameters.
๐ LANGUAGES AND SCRIPTS ๐
so, to recognize some text with Tesseract, it is normally necessary to specify the language(s) or script(s) of the text (unless it's English text, which is supported by default). you do that with -l LANG or -l SCRIPT. English girlies get a free pass, everyone else gotta introduce themselves ๐
selecting a language automatically also selects the language specific character set and dictionary (word list). two for one, slay.
selecting a script typically selects all characters of that script, which can be from different languages. the dictionary which is included also contains a mix from different languages. in most cases, a script also supports English. so it is possible to recognize a language that has not been specifically trained for by using traineddata for the script it is written in. loophole found, loophole ate ๐ฅ
more than one language or script may be specified by using +. example:
tesseract myimage.png myimage -l eng+deu+fra
https://github.com/tesseract-ocr/tessdata_fast provides fast language and script models which are also part of Linux distributions.
for Tesseract 4, tessdata_fast includes traineddata files for the following languages:
afr (Afrikaans), amh (Amharic), ara (Arabic), asm (Assamese), aze (Azerbaijani), aze_cyrl (Azerbaijani - Cyrillic), bel (Belarusian), ben (Bengali), bod (Tibetan), bos (Bosnian), bre (Breton), bul (Bulgarian), cat (Catalan; Valencian), ceb (Cebuano), ces (Czech), chi_sim (Chinese simplified), chi_tra (Chinese traditional), chr (Cherokee), cos (Corsican), cym (Welsh), dan (Danish), deu (German), deu_latf (German Fraktur Latin), div (Dhivehi), dzo (Dzongkha), ell (Greek, Modern, 1453-), eng (English), enm (English, Middle, 1100-1500), epo (Esperanto), equ (Math / equation detection module), est (Estonian), eus (Basque), fas (Persian), fao (Faroese), fil (Filipino), fin (Finnish), fra (French), frm (French, Middle, ca.1400-1600), fry (West Frisian), gla (Scottish Gaelic), gle (Irish), glg (Galician), grc (Greek, Ancient, to 1453), guj (Gujarati), hat (Haitian; Haitian Creole), heb (Hebrew), hin (Hindi), hrv (Croatian), hun (Hungarian), hye (Armenian), iku (Inuktitut), ind (Indonesian), isl (Icelandic), ita (Italian), ita_old (Italian - Old), jav (Javanese), jpn (Japanese), kan (Kannada), kat (Georgian), kat_old (Georgian - Old), kaz (Kazakh), khm (Central Khmer), kir (Kirghiz; Kyrgyz), kmr (Kurdish Kurmanji), kor (Korean), kor_vert (Korean vertical), lao (Lao), lat (Latin), lav (Latvian), lit (Lithuanian), ltz (Luxembourgish), mal (Malayalam), mar (Marathi), mkd (Macedonian), mlt (Maltese), mon (Mongolian), mri (Maori), msa (Malay), mya (Burmese), nep (Nepali), nld (Dutch; Flemish), nor (Norwegian), oci (Occitan post 1500), ori (Oriya), osd (Orientation and script detection module), pan (Panjabi; Punjabi), pol (Polish), por (Portuguese), pus (Pushto; Pashto), que (Quechua), ron (Romanian; Moldavian; Moldovan), rus (Russian), san (Sanskrit), sin (Sinhala; Sinhalese), slk (Slovak), slv (Slovenian), snd (Sindhi), spa (Spanish; Castilian), spa_old (Spanish; Castilian - Old), sqi (Albanian), srp (Serbian), srp_latn (Serbian - Latin), sun (Sundanese), swa (Swahili), swe (Swedish), syr (Syriac), tam (Tamil), tat (Tatar), tel (Telugu), tgk (Tajik), tha (Thai), tir (Tigrinya), ton (Tonga), tur (Turkish), uig (Uighur; Uyghur), ukr (Ukrainian), urd (Urdu), uzb (Uzbek), uzb_cyrl (Uzbek - Cyrillic), vie (Vietnamese), yid (Yiddish), yor (Yoruba)
like. that's the whole world in a list and it's beautiful ๐ญ
to use a non-standard language pack named foo.traineddata, set the TESSDATA_PREFIX environment variable so the file can be found at TESSDATA_PREFIX/tessdata/foo.traineddata and give Tesseract the argument -l foo. DIY language, we respect the hustle ๐ซถ
for Tesseract 4, tessdata_fast includes traineddata files for the following scripts:
Arabic, Armenian, Bengali, Canadian_Aboriginal, Cherokee, Cyrillic, Devanagari, Ethiopic, Fraktur, Georgian, Greek, Gujarati, Gurmukhi, HanS (Han simplified), HanS_vert (Han simplified, vertical), HanT (Han traditional), HanT_vert (Han traditional, vertical), Hangul, Hangul_vert (Hangul vertical), Hebrew, Japanese, Japanese_vert (Japanese vertical), Kannada, Khmer, Lao, Latin, Malayalam, Myanmar, Oriya (Odia), Sinhala, Syriac, Tamil, Telugu, Thaana, Thai, Tibetan, Vietnamese.
the same languages and scripts are available from https://github.com/tesseract-ocr/tessdata_best. tessdata_best provides slow language and script models. these models are needed for training. they also can give better OCR results, but the recognition takes much more time. trade-off queen โ accuracy or speed, pick your fighter โ๏ธ
both tessdata_fast and tessdata_best only support the LSTM OCR engine. important!! don't come crying to me when the legacy engine doesn't show up to the party ๐
there is a third repository, https://github.com/tesseract-ocr/tessdata, with models which support both the Tesseract 3 legacy OCR engine and the Tesseract 4 LSTM OCR engine. the versatile one. the one that gets along with everybody ๐
๐ CONFIG FILES AND AUGMENTING WITH USER DATA ๐
ok so tesseract config files are literally just lines of parameter-value pairs, space separated. that's it. that's the whole format bestie ๐
the parameters themselves are documented as flags in the source code, like this one living in tesseractclass.h:
STRING_VAR_H(tessedit_char_blacklist, "", "Blacklist of chars not to
recognize");
these parameters can enable or disable different features of the engine, and they can make it load (or not load) different data. so for instance โ let's say you wanna OCR in English, but you want to suppress the normal dictionary and load an alternative word list plus an alternative list of patterns. those two files are the most commonly used extra data files, fyi.
so if your language pack is sitting in /path/to/eng.traineddata and the hocr config is in /path/to/configs/hocr, create three new files:
/path/to/eng.user-words:
the
quick
brown
fox
jumped
/path/to/eng.user-patterns:
1-\d\d\d-GOOG-411
www.\n\\\*.com
/path/to/configs/bazaar:
load_system_dawg F
load_freq_dawg F
user_words_suffix user-words
user_patterns_suffix user-patterns
now, if you pass the word bazaar as a CONFIGFILE to Tesseract, it will โจ not โจ bother loading the system dictionary or the dictionary of frequent words, and it'll load and use the eng.user-words and eng.user-patterns files you provided. the first one is a simple word list, one per line. the format of the second one is documented in dict/trie.h on read_pattern_list() ๐ซถ
โจ PARAMETERS โจ
Tesseract parameters control the behaviour of the OCR engine, and you can set them with the -c option (like -c tessedit_char_whitelist=0123456789) or by dropping them in a CONFIGFILE. the example above restricts recognized characters to digits only, no cap. run --print-parameters to list every available parameter with its current value and a lil short description ๐
the engine column tells you which OCR engine modes support a parameter:
- Both โ works with both the LSTM and Legacy engines
- LSTM โ only applies to the neural-network LSTM engine (OEM 1 or 2)
- Legacy โ only applies to the legacy Tesseract engine (OEM 0 or 2)
๐ OUTPUT FORMAT PARAMETERS ๐
tessedit_create_txtโ bool, default:0,[Both]. write plain-text output to a.txtfile. this is the default output format when nothing (no config file, no-coption) overrides it.tessedit_create_hocrโ bool, default:0,[Both]. write hOCR output to a.hocrfile. hOCR is an HTML-based format that encodes the OCR results together with their bounding boxes and confidences. use thehocrconfig file to enable this format. the hOCR specification lives athttps://kba.github.io/hocr-spec/1.2/if you wanna see the details of the output format ๐hocr_font_infoโ bool, default:0,[Both]. add per-word font metadata to hOCR output. when it's on, each word span includesx_font(font name) andx_fsize(point size) attributes in its title field. the font info comes from the recognition results and is most reliable with the Legacy OCR engine โ the LSTM engine may produce less precise font names ๐ญhocr_char_boxesโ bool, default:0,[Both]. add per-character bounding-box coordinates to hOCR output asocrx_cinfospans. heads up though: character-level bounding boxes may be less precise when you're using the LSTM engine, because LSTM operates at the line level and character positions are approximated from the line result. see alsolstm_choice_modefor LSTM-specific character alternative output ๐ซtessedit_create_altoโ bool, default:0,[Both]. write ALTO XML output to a.xmlfile. ALTO (Analyzed Layout and Text Object) is a standard XML schema for describing the layout and content of pages. use thealtoconfig file to enable this format.tessedit_create_page_xmlโ bool, default:0,[Both]. write PAGE XML output to a.page.xmlfile. PAGE (Page Analysis and Ground Truth Elements) is a standard XML format that's widely used in digital humanities projects, library and archive workflows, and document annotation tools like Transkribus and eScriptorium. spec is athttps://github.com/PRImA-Research-Lab/PAGE-XML. use thepageconfig file to enable this format ๐ฆpage_xml_polygonโ bool, default:1,[Both]. when writing PAGE XML output, create polygon outlines around text regions instead of simple bounding boxes.page_xml_levelโ int, default:0,[Both]. granularity of PAGE XML output:0= line level,1= word level.tessedit_create_tsvโ bool, default:0,[Both]. write tab-separated-values output to a.tsvfile. every recognized word comes out as one row with its bounding box, confidence and text. use thetsvconfig file to enable this format.tessedit_create_pdfโ bool, default:0,[Both]. write a searchable PDF to a.pdffile. the PDF contains the original image with an invisible text layer for copy-paste and searching. use thepdfconfig file to enable this format ๐textonly_pdfโ bool, default:0,[Both]. write a text-only PDF (no image, just invisible text) to a.pdffile.tessedit_create_boxfileโ bool, default:0,[Both]. write a Tesseract box file (.box) that lists each recognized character with its bounding box, one per line. either engine can produce it. these files are primarily used as ground truth for legacy engine training ๐งtessedit_create_wordstrboxโ bool, default:0,[Both]. write a WordStr-format box file (.box). similar totessedit_create_boxfilebut records whole words instead of individual characters.tessedit_create_lstmboxโ bool, default:0,[LSTM]. write an LSTM box file (.box) suitable for LSTM training.preserve_interword_spacesโ bool, default:0,[Both]. preserve multiple consecutive inter-word spaces in the output instead of collapsing them down to a single space.
๐ธ CHARACTER SET PARAMETERS ๐ธ
tessedit_char_whitelistโ string, default:"",[Both]. restrict the set of characters Tesseract will recognize to only the ones listed in this string (allowlist). for example, setting this to0123456789makes Tesseract return only digits. an empty value (the default) means all characters in the trained data are allowed ๐tessedit_char_blacklistโ string, default:"",[Both]. stop Tesseract from recognizing the characters listed in this string. characters in this list will never show up in the output. this exclusion list is applied after the allowlist (tessedit_char_whitelist).tessedit_char_unblacklistโ string, default:"",[Both]. re-allow specific characters that got excluded bytessedit_char_blacklist. characters in this list override the exclusion list, and it applies to both the LSTM and Legacy engines ๐
๐ฆ IMAGE PROCESSING PARAMETERS ๐ฆ
thresholding_methodโ int, default:0,[Both]. pick the algorithm used to convert a greyscale image to binary before OCR:0= Otsu global thresholding (default);1= LeptonicaOtsu (tiled Otsu, better for uneven lighting);2= Sauvola local adaptive thresholding (best for heavily degraded documents) ๐ฅthresholding_window_sizeโ double, default:0.33,[Both]. window size (multiplied by image DPI) used to compute local statistics for the Sauvola thresholding method (thresholding_method=2).thresholding_kfactorโ double, default:0.34,[Both]. sensitivity factor for Sauvola thresholding (thresholding_method=2). controls how much the local variance reduces the threshold. typical range:0.2โ0.5. higher values produce more aggressive thresholding.thresholding_tile_sizeโ double, default:0.33,[Both]. desired tile size (multiplied by image DPI) for the LeptonicaOtsu tiled thresholding method (thresholding_method=1).thresholding_smooth_kernel_sizeโ double, default:0,[Both]. kernel size for smoothing the threshold array produced by LeptonicaOtsu (thresholding_method=1). use0for no smoothing.thresholding_score_fractionโ double, default:0.1,[Both]. fraction of the maximum Otsu score used by LeptonicaOtsu (thresholding_method=1). use0.0for standard Otsu behaviour;0.1is recommended for better robustness โจtessedit_do_invertโ bool, default:1,[Both]. deprecated โ will be removed in a future release ๐ when enabled, Tesseract tries OCR on an inverted (white-on-black) copy of lines whose mean confidence falls belowinvert_thresholdand keeps whichever result has higher confidence. to disable automatic inversion, setinvert_threshold=0rather than setting this parameter to0.invert_thresholdโ double, default:0.7,[Both]. mean confidence threshold below which Tesseract will also attempt OCR on the inverted image. lower values make inversion less likely. set it to0to disable automatic inversion entirely (this is preferred over settingtessedit_do_invert=0, which is deprecated ๐ซถ).user_defined_dpiโ int, default:0,[Both]. override the resolution of the input image in DPI. use this when the image metadata has a wrong or missing DPI value. a value of0means the resolution gets read from the image metadata or guessed automatically. this parameter is equivalent to the--dpicommand-line option; when--dpiis given on the command line it just sets this parameter ๐textord_heavy_nrโ bool, default:0,[Both]. aggressively remove noise blobs during page layout analysis. when it's disabled (the default), Tesseract applies a moderate noise threshold that preserves most legitimate characters. enabling this raises the threshold significantly, which can improve results on scans with heavy speckle or background noise โ but it may also remove small legitimate characters like punctuation marks, diacritics or small symbols ๐ญ useful for OCR-ing degraded or low-quality document scans where accuracy on punctuation matters less than overall text extraction.
๐ DICTIONARY PARAMETERS ๐
load_system_dawgโ bool, default:1,[Both]. load the main system word list (DAWG) from the traineddata file. disabling this can speed up recognition and may improve results when you're OCR-ing content that doesn't resemble natural language (codes, identifiers, etc.).load_freq_dawgโ bool, default:1,[Both]. load the list of frequent words from the traineddata file.load_unambig_dawgโ bool, default:1,[Legacy]. load the list of unambiguous words from the traineddata file.load_punc_dawgโ bool, default:1,[Legacy]. load the dawg containing punctuation patterns from the traineddata file.load_number_dawgโ bool, default:1,[Legacy]. load the dawg containing number patterns from the traineddata file ๐load_bigram_dawg(bool, default:1) [Legacy] โ loads the dawg with the special word bigrams out of the traineddata file.user_words_file(string, default:"") [Both] โ path to a plain-text file of extra words (one per line) that Tesseract should treat as legit dictionary words.user_words_suffix(string, default:"") [Both] โ a filename suffix (relative to the tessdata directory) for a per-language file of extra valid words. So like, if you set this touser-words, Tesseract goes looking foreng.user-wordswhen it's using the English model. iykyk.user_patterns_file(string, default:"") [Both] โ path to a plain-text file of extra pattern strings (one per line) that Tesseract should accept as valid words. In the pattern language, backslash-escaped sequences specify character classes:\d= any digit;\c= any letter;\a= any lowercase letter;\A= any uppercase letter;\n= any alphanumeric character;\p= any punctuation character. All other characters match themselves. Example:1-\d\d\d-GOOG-411matches a phone-number-ish string. These are structural templates, not regular expressions, bestie. For the full pattern syntax, seedict/trie.hin the Tesseract source.user_patterns_suffix(string, default:"") [Both] โ a filename suffix (relative to the tessdata directory) for a per-language file of extra patterns.
โจ LSTM ENGINE PARAMETERS โจ
Okay so these ones only actually do anything when you're running the LSTM OCR engine (--oem 1 or --oem 2). Like, they're literally only meaningful there ๐
lstm_use_matrix(bool, default:1) [LSTM] โ uses the ratings matrix and beam search during LSTM decoding. Turn it off and you get a simpler, faster greedy decoding strategy instead, which might be fine for super clean, high-quality images but generally gives lower accuracy. So like, risky vibe ngl.lstm_choice_mode(int, default:0) [LSTM] โ enables alternative character hypotheses in hOCR output (requirestessedit_create_hocr = 1):0= disabled (that's the default);1= include per-timestep alternative choices;2= extract alternative choices from the CTC output mapped per character. Also peephocr_char_boxesfor character bounding-box output ๐lstm_choice_iterations(int, default:5) [LSTM] โ how many cascading beam-search iterations happen whenlstm_choice_modeis non-zero.lstm_rating_coefficient(double, default:5) [LSTM] โ a scaling factor applied to LSTM character ratings. Smaller values = higher (better) confidence scores and they preserve more info before the zero cut-off. Default is5, periodt.
๐ LEGACY ENGINE PARAMETERS ๐
These ones apply only when you're using the legacy Tesseract engine (--oem 0 or --oem 2, and it requires a traineddata file that includes the legacy model, like the ones from https://github.com/tesseract-ocr/tessdata).
tessedit_enable_bigram_correction(bool, default:1) [Legacy] โ applies bigram-based correction to improve recognition of adjacent word pairs that commonly show up together (e.g."is a","in the","New York"). The correction uses a bigram dictionary from the traineddata file to re-score word hypotheses in context. Iconic behaviour, honestly.tessedit_enable_dict_correction(bool, default:0) [Legacy] โ uses the dictionary to post-correct uncertain word hypotheses.tessedit_fix_fuzzy_spaces(bool, default:1) [Legacy] โ tries to fix spaces that got ambiguously classified as inter-word or inter-character gaps. The eternal struggle ๐ญlanguage_model_penalty_non_dict_word(double, default:0.15) [Legacy] โ a penalty added to the score of word hypotheses that aren't in the dictionary. Crank it up to bias recognition harder towards dictionary words.language_model_penalty_non_freq_dict_word(double, default:0.1) [Legacy] โ an extra penalty for words that are in the dictionary but aren't in the list of frequent words.language_model_penalty_case(double, default:0.1) [Legacy] โ penalty applied when a recognised word's capitalisation doesn't match the surrounding context.language_model_penalty_script(double, default:0.5) [Legacy] โ penalty applied when a recognised character belongs to a different script from the surrounding text.language_model_penalty_punc(double, default:0.2) [Legacy] โ penalty for punctuation usage that's inconsistent with the language model.wordrec_enable_assoc(bool, default:1) [Legacy] โ enables the associator, which considers combinations of character fragments when forming word hypotheses. Turning it off might speed things up, but you pay for it in accuracy on fragmented characters. Trade-offs, bestie ๐
๐ซถ DEBUG PARAMETERS ๐ซถ
debug_file(string, default:"") [Both] โ redirects Tesseract's debug/diagnostic output to this file instead ofstderr. Set it to/dev/null(or just use thequietconfig file) to suppress all that debug noise entirely.tessedit_write_params_to_file(string, default:"") [Both] โ if you set this to a filename, Tesseract writes the values of all its parameters to that file when it starts up. So useful for capturing the effective config for debugging or reproducibility. Lowkey a lifesaver.
๐ธ ENVIRONMENT VARIABLES ๐ธ
TESSDATA_PREFIXโ ifTESSDATA_PREFIXis set to a path, then that path gets used to find the tessdata directory with the language and script recognition models and config files. Using--tessdata-dir PATHis the recommended alternative though.OMP_THREAD_LIMITโ if thetesseractexecutable was built with multithreading support, it normally uses four CPU cores for the OCR process. That can be faster for a single image, but it gives bad performance if the host computer has less than four CPU cores or if you're doing OCR on many images. Only a single CPU core is used withOMP_THREAD_LIMIT=1.
๐ HISTORY ๐
Okay storytime, because this engine has lore.
The engine was developed at Hewlett Packard Laboratories Bristol and at Hewlett Packard Co, Greeley Colorado between 1985 and 1994, with some more changes made in 1996 to port to Windows, and some C++izing in 1998. A lot of the code was written in C, and then some more was written in C++. The C++ code makes heavy use of a list system using macros. This predates STL, was portable before STL, and is more efficient than STL lists โ but it has the big negative that if you do get a segmentation violation, it is hard to debug. Not me crying over segfaults ๐
Version 2.00 brought Unicode (UTF-8) support, six languages, and the ability to train Tesseract.
Tesseract was included in UNLV's Fourth Annual Test of OCR Accuracy. See https://github.com/tesseract-ocr/docs/blob/main/AT-1995.pdf. Since Tesseract 2.00, scripts are now included so literally anyone can reproduce some of these tests. See https://tesseract-ocr.github.io/tessdoc/TestingTesseract.html for more details.
Tesseract 3.00 added a bunch of new languages, including Chinese, Japanese, and Korean. It also introduced a new, single-file based system of managing language data.
Tesseract 3.02 added BiDirectional text support, the ability to recognize multiple languages in a single image, and improved layout analysis.
Tesseract 4 adds a new neural net (LSTM) based OCR engine which is focused on line recognition, but it also still supports the legacy Tesseract OCR engine of Tesseract 3 which works by recognizing character patterns. Compatibility with Tesseract 3 is enabled by --oem 0. This also needs traineddata files which support the legacy engine, for example those from the tessdata repository (https://github.com/tesseract-ocr/tessdata).
For further details, see the release notes in the Tesseract documentation (https://tesseract-ocr.github.io/tessdoc/ReleaseNotes.html).
๐ฆ RESOURCES ๐ฆ
- Main web site:
https://github.com/tesseract-ocr - User forum:
https://groups.google.com/g/tesseract-ocr - Documentation:
https://tesseract-ocr.github.io/ - Information on training:
https://tesseract-ocr.github.io/tessdoc/Training-Tesseract.html
๐ SEE ALSO ๐
ambiguous_words(1), cntraining(1), combine_tessdata(1), dawg2wordlist(1), shape_training(1), mftraining(1), unicharambigs(5), unicharset(5), unicharset_extractor(1), wordlist2dawg(1)
Go read them, bestie, they're all part of the same friend group โจ
๐ AUTHOR ๐
Tesseract development was led at Hewlett-Packard and Google by Ray Smith. The development team has included:
Ahmad Abdulkader, Chris Newton, Dan Johnson, Dar-Shyang Lee, David Eger, Eric Wiseblatt, Faisal Shafait, Hiroshi Takenaka, Joe Liu, Joern Wanke, Mark Seaman, Mickey Namiki, Nicholas Beato, Oded Fuhrmann, Phil Cheatle, Pingping Xiu, Pong Eksombatchai (Chantat), Ranjith Unnikrishnan, Raquel Romano, Ray Smith, Rika Antonova, Robert Moss, Samuel Charron, Sheelagh Lloyd, Shobhit Saxena, and Thomas Kielbus.
For a list of contributors see https://github.com/tesseract-ocr/tesseract/blob/main/AUTHORS.
โญ COPYING โญ
Licensed under the Apache License, Version 2.0
And that's the whole page, bestie ๐ This isTESSERACT(1)โ source and version stamped2026-09-28in the footer, dated the same day. Now go OCR something iconic. Slay ๐ซถโจ
๐ฆ where this page comes from
- opensuse-leap 16.0: tesseract-ocr 5.5.3-bp160.2.1 ยท Apache-2.0 AND GPL-2.0-or-later
- opensuse-leap 16.0: tesseract-ocr 5.5.3-bp160.2.1 ยท Apache-2.0 AND GPL-2.0-or-later
- opensuse-leap 16.0: tesseract-ocr 5.5.3-bp160.2.1 ยท Apache-2.0 AND GPL-2.0-or-later
- opensuse-leap 16.0: tesseract-ocr 5.5.3-bp160.2.1 ยท Apache-2.0 AND GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms