{"id":14037244,"url":"https://github.com/newsdev/rocketdocket","last_synced_at":"2025-07-27T05:31:03.584Z","repository":{"id":137634316,"uuid":"139589258","full_name":"newsdev/rocketdocket","owner":"newsdev","description":"The fastest, cleanest, most reproducible ways to OCR a document.","archived":true,"fork":false,"pushed_at":"2019-04-15T16:41:58.000Z","size":2,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-13T03:07:16.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newsdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-07-03T13:41:16.000Z","updated_at":"2024-06-20T20:50:13.000Z","dependencies_parsed_at":"2024-01-29T08:09:37.683Z","dependency_job_id":"c35e1399-5120-409d-a922-e30053e504d8","html_url":"https://github.com/newsdev/rocketdocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newsdev%2Frocketdocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newsdev%2Frocketdocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newsdev%2Frocketdocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newsdev%2Frocketdocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newsdev","download_url":"https://codeload.github.com/newsdev/rocketdocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227762629,"owners_count":17816053,"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":[],"created_at":"2024-08-12T03:02:36.818Z","updated_at":"2024-12-02T16:32:32.816Z","avatar_url":"https://github.com/newsdev.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# ROCKETDOCKET\n\nOCRing a PDF requires a few steps if you'd like to do it in parallel.\n\nCurrently, we're taking in a single large PDF and producing a single text file for each page.\n\nDecisions should be made about what to do with those text files. Put 'em in Elasticsearch? Combine them back into a giant PDF? Both? Neither?\n\n## Ghostscript\n```\ntime gs\\\n    -o file-%05d.png\\\n    -sDEVICE=pngmono\\\n    -dNumRenderingThreads=$(sysctl -n hw.ncpu)\\\n    -dBandHeight=100\\\n    -dBufferSpace=1000000000\\\n    -dBandBufferSpace=500000000\\\n    -sBandListStorage=memory\\\n    -dBATCH\\\n    -dNOPAUSE\\\n    -dNOGC\\ \n    -r72\\\n    original.pdf\n```\n\n### Explanation\n* `-o file-%05d.png`: Outputs file names like `file-00405.png`, one for each page.\n* `-dNumRenderingThreads=$(sysctl -n hw.ncpu)`: Makes a thread for every CPU (or virtual CPU) your computer claims to have.\n* `-sDEVICE=pngmono`: The fastest output, in my testing, is with the `pngmono` engine, which is a black-and-white PNG with no transparency. PNG is also the fastest for Tesseract to process.\n* `-dBandHeight=100 -dBufferSpace=1000000000 -dBandBufferSpace=500000000 -sBandListStorage=memory`: Sets up a large amount of memory for creating PNGs.\n* `-dBATCH -dNOPAUSE -dNOGC`: From the internet, things you can turn off to increase speed.\n* `-r72`: Produces a 72-dpi PNG image. Smaller numbers here are faster to generate, but OCR quality decreases quite a bit as you descend below this.\n\n## Tesseract\n```\ntime ls *.png | xargs -n 1 -P $(sysctl -n hw.ncpu) ./ocr.sh\n```\n\n### Explanation\n* `ls *.png`: Produces output where each filename is on a single line.\n* `| xargs`: Takes the output of `ls *.png` and feeds it to `xargs`\n* `-n 1`: Each line contains something we'd like to process, aka, a PNG file path.\n* `-P $(sysctl -n hw.ncpu)`: `xargs` should use one process per CPU (or virtual CPU) your computer claims to have.\n* `./ocr.sh`: Runs whatever is in `ocr.sh` with the name of the PNG file as the argument.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewsdev%2Frocketdocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewsdev%2Frocketdocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewsdev%2Frocketdocket/lists"}