TEXT2IMAGE(1)
π
TEXT2IMAGE(1) β the text2image manual page, bestie edition π
okay so real talk: this is the manual page for text2image, and yes we're gonna get through all of it together, no skimming, no "eh I'll figure it out later" β¨
πΈ NAME πΈ
text2image β generates OCR training pages. that's the whole vibe. it makes pages. for training. OCR. slay.
π¦ SYNOPSIS π¦
text2image --text FILE --outputbase PATH --fonts_dir PATH [OPTION]
three things you basically gotta give it: a text file, an output base, and where the fonts live. the [OPTION] part is where you go feral, and honestly there's a lot of room to go feral. π
β¨ DESCRIPTION β¨
so text2image(1) generates OCR training pages. like, that's its whole job, and it's very good at it. you hand it a text file, it hands you back an image β with a font you picked and degradation applied. synthetic training data, homemade, fresh out the oven. π
π₯ OPTIONS π₯
--textFILE β file name of text input to use for creating synthetic training data. (type:string default:)--outputbaseFILE β basename for output image/box file. this is the name-stem everything gets built off of. (type:string default:)--fontconfig_tmpdirPATH β overrides fontconfig default temporary dir. (type:string default:/tmp)--fonts_dirPATH β if empty it uses the system default. otherwise it overrides the system default font location. (type:string default:)--fontFONTNAME β font description name to use. (type:string default:Arial)--writing_modeMODE β specify one of the following writing modes.horizontal: render regular horizontal text. (default)vertical: render vertical text. glyph orientation is selected by Pango.vertical-upright: render vertical text. glyph orientation is set to be upright. (type:string default:horizontal)--tlog_levelINT β minimum logging level fortlog()output. (type:int default:0)--max_pagesINT β maximum number of pages to output (0=unlimited). (type:int default:0)--degrade_imageBOOL β degrade rendered image with speckle noise, dilation/erosion and rotation. mess it up on purpose, that's the point π (type:bool default:true)--rotate_imageBOOL β rotate the image in a random way. (type:bool default:true)--strip_unrenderable_wordsBOOL β remove unrenderable words from source text. (type:bool default:true)--ligaturesBOOL β rebuild and render ligatures. (type:bool default:false)--exposureINT β exposure level in photocopier. (type:int default:0)--resolutionINT β pixels per inch. (type:int default:300)--xsizeINT β width of output image. (type:int default:3600)--ysizeINT β height of output image. (type:int default:4800)--marginINT β margin round edges of image. (type:int default:100)--ptsizeINT β size of printed text. (type:int default:12)--leadingINT β inter-line space (in pixels). (type:int default:12)--box_paddingINT β padding around produced bounding boxes. (type:int default:0)--char_spacingDOUBLE β inter-character space in ems. (type:double default:0)--underline_start_probDOUBLE β fraction of words to underline (value in[0,1]). (type:double default:0)--underline_continuation_probDOUBLE β fraction of words to underline (value in[0,1]). (type:double default:0)--render_ngramsBOOL β put each space-separated entity from the input file into one bounding box. the ngrams in the input file will be randomly permuted before rendering (so that there is sufficient variety of characters on each line). (type:bool default:false)--output_word_boxesBOOL β output word bounding boxes instead of character boxes. this is used for Cube training, and implied by--render_ngrams. (type:bool default:false)--unicharset_fileFILE β file with characters in the unicharset. if--render_ngramsis true and--unicharset_fileis specified, ngrams with characters that are not in unicharset will be omitted. (type:string default:)--bidirectional_rotationBOOL β rotate the generated characters both ways. (type:bool default:false)--only_extract_font_propertiesBOOL β assumes that the input file contains a list of ngrams. renders each ngram, extracts spacing properties and records them inoutput_base/[font_name].fontinfofile. (type:bool default:false)
π«Ά USE THESE FLAGS TO OUTPUT ZERO-PADDED, SQUARE INDIVIDUAL CHARACTER IMAGES π«Ά
like the heading says β these three are the glow-up squad for solo character portraits. literal main character energy per glyph π
--output_individual_glyph_imagesBOOL β if true also outputs individual character images. (type:bool default:false)--glyph_resized_sizeINT β each glyph is square with this side length in pixels. (type:int default:0)--glyph_num_border_pixels_to_padINT βFinal_size=glyph_resized_size+2*glyph_num_border_pixels_to_pad. (type:int default:0)
π§ USE THESE FLAGS TO FIND FONTS THAT CAN RENDER A GIVEN TEXT π§
font shopping spree time. these let you hunt down every font that can actually handle your text, no cap.
--find_fontsBOOL β search for all fonts that can render the text. (type:bool default:false)--render_per_fontBOOL β iffind_fonts==true, render each font to its own image. image filenames are of the formoutput_name.font_name.tif. (type:bool default:true)--min_coverageDOUBLE β iffind_fonts==true, the minimum coverage the font has of the characters in the text file to include it, between0and1. (type:double default:1)
π Example Usage π
this is the actual example, bestie, and it is iconic β piping straight into grep and sed like a flex:
text2image --find_fonts \
--fonts_dir /usr/share/fonts \
--text ../langdata/hin/hin.training_text \
--min_coverage .9 \
--render_per_font \
--outputbase ../langdata/hin/hin \
|& grep raw | sed -e 's/ :.*/" \\/g' | sed -e 's/^/ "/' >../langdata/hin/fontslist.txt
β SINGLE OPTIONS β
one option. just the one. she's solo and she's thriving.
--list_available_fontsBOOL β list available fonts and quit. (type:bool default:false)
π HISTORY π
text2image(1) was first made available for tesseract 3.03. a true vintage queen, honestly. π
π¦ RESOURCES π¦
- Main web site:
https://github.com/tesseract-ocr - Information on training tesseract LSTM:
https://tesseract-ocr.github.io/tessdoc/TrainingTesseract-4.00.html
π SEE ALSO π
tesseract(1) β go say hi to her too π«Ά
π COPYING π
Copyright (C) 2012 Google, Inc. Licensed under the Apache License, Version 2.0
π AUTHOR π
The Tesseract OCR engine was written by Ray Smith and his research groups at Hewlett Packard (1985-1995) and Google (2006-2018). legends, fr fr.
and that's the whole page!! this little time capsule is stamped 2026-09-28 and it'll always be filed under TEXT2IMAGE(1) β so if you ever forget any of it, just look at the footer of your heart (or, y'know, run the man page again π). mwah π
π¦ 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