{"content":"# aux4/image-text\n\nExtract text from images using OCR powered by Tesseract.\n\nThis package extends the aux4 image command group with a text subcommand for optical character recognition. When installed alongside aux4/image, both packages share the same image profile and their commands merge seamlessly.\n\n## Install\n\n``bash\naux4 aux4 pkger install aux4/image-text\n`\n\n### Requirements\n\n- [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) (auto-installed if missing)\n\n## Usage\n\n`bash\naux4 image text <file> [--lang <language>] [--psm <mode>]\naux4 image pdf <file> [--input <file2> ...] [--output <name>] [--lang <language>]\n`\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| aux4 image text | Extract text from an image using OCR |\n| aux4 image pdf | Generate a searchable PDF from one or more images |\n\n## Options\n\n### --lang\n\nOCR language code (default: eng). Use tesseract --list-langs to see installed languages.\n\n### --psm\n\nPage segmentation mode (default: 3). Controls how tesseract interprets the image layout:\n\n| Mode | Description |\n|------|-------------|\n| 0 | Orientation and script detection (OSD) only |\n| 1 | Automatic page segmentation with OSD |\n| 2 | Automatic page segmentation, but no OSD or OCR |\n| 3 | Fully automatic page segmentation, but no OSD (default) |\n| 4 | Assume a single column of text of variable sizes |\n| 5 | Assume a single uniform block of vertically aligned text |\n| 6 | Assume a single uniform block of text |\n| 7 | Treat the image as a single text line |\n| 8 | Treat the image as a single word |\n| 9 | Treat the image as a single word in a circle |\n| 10 | Treat the image as a single character |\n| 11 | Sparse text — find as much text as possible in no particular order |\n| 12 | Sparse text with OSD |\n| 13 | Raw line — treat the image as a single text line, no hacks |\n\n## Examples\n\nExtract text from a screenshot:\n\n`bash\naux4 image text screenshot.png\n`\n\nExtract a single line from a label:\n\n`bash\naux4 image text label.png --psm 7\n`\n\nExtract text in Spanish:\n\n`bash\naux4 image text documento.png --lang spa\n`\n\nGenerate a searchable PDF:\n\n`bash\naux4 image pdf scan.png\naux4 image pdf scan.png --output archived-scan\n`\n\nCreate a multi-page PDF from multiple images:\n\n`bash\naux4 image pdf --input page1.png --input page2.png --input page3.png --output document\n`\n\n## Language Packs\n\nTesseract supports many languages. Install additional language packs:\n\n`bash\n# macOS\nbrew install tesseract-lang\n\n# Ubuntu/Debian\napt install tesseract-ocr-spa tesseract-ocr-deu tesseract-ocr-fra\n`\n\nCommon language codes: eng (English), spa (Spanish), deu (German), fra (French), por (Portuguese), ita (Italian), jpn (Japanese), chi_sim` (Chinese Simplified).\n\n## License\n\nApache-2.0\n"}