{"id":13566676,"url":"https://github.com/freedmand/textra","last_synced_at":"2025-04-04T16:16:15.921Z","repository":{"id":64966361,"uuid":"573902991","full_name":"freedmand/textra","owner":"freedmand","description":"A command-line application to convert images, PDFs, and audio files to text using Apple's APIs","archived":false,"fork":false,"pushed_at":"2023-04-14T12:51:15.000Z","size":1513,"stargazers_count":736,"open_issues_count":7,"forks_count":26,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-28T15:11:12.239Z","etag":null,"topics":["command-line-tool","macos","ocr","transcription"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/freedmand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-03T19:49:12.000Z","updated_at":"2025-03-26T12:35:04.000Z","dependencies_parsed_at":"2024-01-18T05:21:18.015Z","dependency_job_id":"92fc841e-feeb-4de8-a596-edb6e5dbd063","html_url":"https://github.com/freedmand/textra","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freedmand%2Ftextra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freedmand%2Ftextra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freedmand%2Ftextra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freedmand%2Ftextra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freedmand","download_url":"https://codeload.github.com/freedmand/textra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208183,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","macos","ocr","transcription"],"created_at":"2024-08-01T13:02:14.469Z","updated_at":"2025-04-04T16:16:15.896Z","avatar_url":"https://github.com/freedmand.png","language":"Swift","readme":"# textra\n\nA command-line application to extract text from images, PDFs, and audio files using Apple's Vision and Speech APIs.\n\n![A terminal window showing the text: | % textra The-Mueller-Report.pdf -o report.txt | Converting: | - Input (448 pg) The-Mueller-Report.pdf | - Output full text report.txt | | 16 of 448 [-      ] ETA: 00:05:21 (at 1.34 it/s)](https://user-images.githubusercontent.com/306095/208481023-dded4395-5969-4401-ad08-b625eadd33bf.png)\n\n## Installation\n\nTextra requires Mac OS version 13 or greater to access the latest VisionKit APIs.\n\nThe easiest way to install `textra` is to open a terminal window and run the following command:\n\n```sh\ncurl -L https://github.com/freedmand/textra/raw/main/install.sh | bash\n```\n\nAlternatively, download the latest [release](https://github.com/freedmand/textra/releases), unzip it, and place the `textra` executable somewhere on your `$PATH`.\n\n## Usage\n\n```sh\ntextra [options] FILE1 [FILE2...] [outputOptions]\n```\n\n### Options\n\n**`-h`, `--help`**: Show advanced help\n\n**`-s`, `--silent`**: Suppress non-essential output\n\n**`-l`, `--locale`**: Specify a [locale](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html) (e.g. en-US) for text recognition\n\n**`-v`, `--version`**: Show version number\n\n### Output options\n\n**`-x`, `--outputStdout`**: Output everything to stdout (default)\n\n**`-o`, `--outputText`**: Output everything to a single text file\n\n**`-t`, `--outputPageText`**: Output each file/page to a text file\n\n**`-p`, `--outputPositions`**: Output positional text for each file/page to json (experimental; results may differ from page text)\n\n### Examples\n\n`textra audio.mp3`: Extract the text from \"audio.mp3\" and output to stdout\n\n`textra page1.png page2.png -o combined.txt`: Extract the text from \"page1.png\" and \"page2.png\" and output the combined text to \"combined.txt\"\n\n`textra doc.pdf -o doc.txt -t doc/page-{}.txt`: Extract text from \"doc.pdf\" and output in two formats: 1) combined text of all the pages stored in \"doc.txt\" and 2) positional text from each page extracted at the pattern \"doc/page-{}.txt\" (e.g. \"doc/page-1.txt\", \"doc/page-2.txt\", etc.)\n\n`textra image1.png -o text1.txt image2.png -o text2.txt`: Extract text from \"image1.png\" and output at \"text1.txt\"; extract text from \"image2.png\" and output at \"text2.txt\"\n\n`textra image.png --outputPositions positionalText.json`: Extract positional text from \"image.png\" and output at \"positionalText.json\"\n\n### Instructions\n\nTo use `textra`, you must provide at least one input file.\n\n`textra` will then extract all the text from the inputted image/PDF/audio files. By default,\n`textra` will print the output to stdout, where it can be viewed or piped into another\nprogram.\n\nYou can use the output options above at any point to extract the specified files to disk in\nvarious formats. For instance, `textra doc.png -o page.txt -p page.json` will extract\n\"doc.png\" in two formats: as page text to \"page.txt\" and as positional text to \"page.json\".\n\nYou can punctuate chains of inputs with output options to finely control where multiple\nextracted documents will end up. For example, `textra doc.png -o image.txt speech.mp3 -o\naudio.txt` will extract \"doc.png\" to \"image.txt\" and \"speech.mp3\" to \"audio.txt\"\nrespectively.\n\nFor output options that write to each page (`-t`, `-p`), `textra` allows an output path that\ncontains curly braces `{}`. These braces will be substituted with page numbers in the case of a\nPDF file, base file names in the case of image files, or `baseFileName-pageNumber` in the case\nof multiple PDF files. Without specifying the braces, textra will append a dash followed by\nthe page number/base file name to the specified path.\n\n## Troubleshooting\n\n- **`ERROR: Speech recognizer does not support on-device recognition`**:\n\n  If you get this error, you may need dictation enabled, which you can accomplish in **System Settings** -\u003e **Keyboard** -\u003e **Dictation** -\u003e **Enable dictation**.\n\n  Flipping the dictation setting may not immediately fix the error. If `textra` still provides this error or if you cannot toggle the setting, try clicking the \"Edit\" menu item from the top menu bar when you're in an application (e.g. Terminal) and clicking \"Start dictation.\" This may prompt you to enable \"Dictation\" again, and a microphone prompt may appear (which you can immediately dismiss by clicking \"Done\").\n\n  Try `textra` again. If it does work, you may safely disable dictation at any time in the system settings. If it does not, please file an issue.\n\n## License\n\nMIT\n\n## Contributions\n\nThis repo is in early stages but contributions are welcome. Please submit an issue or feel free to fork and contribute a pull request.\n\n## Credits\n\nMany thanks to [Brandon Roberts](https://journa.host/@bxroberts) and [Marcos Huerta](https://vmst.io/@marcoshuerta) for their help and encouragement with positional text extraction.\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedmand%2Ftextra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreedmand%2Ftextra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedmand%2Ftextra/lists"}