3 ms·
FYI Google already does this automatically: https://searchengineland.com/google-using-ocr-to-index-scanned-documents-15318 https://searchengineland.com/google-u
by solardev 4y ago
FYI Google already does this automatically: https://searchengineland.com/google-using-ocr-to-index-scanned-documents-15318 https://searchengineland.com/google-using-ocr-to-index-scann...
- layer8 4y agoThis is standard functionality of every scan-to-PDF application nowadays. But I guess it’s nice if you happen to come across a scan-only PDF.
- gsich 4y agoSome viewers can do that on the fly, I have used this with Adobe Acrobat.
- danso 4y agoYeah this would’ve been much more exciting for me had I discovered it 5 years ago (its git log starts in 2013). But having a CLI command that I can script will be nice for the occasional project of random scanned papers, or personal documents that I don’t necessarily want in the cloud even if the OCR is free
- gwern 4y agoI think you're underselling ocrmypdf, which I use heavily: 1. Scan-only PDFs are shockingly common: I download papers all the time which are scan-only. 2. Non-scan-only PDFs often have garbage OCR. I assume this is because they were done long ago and never redone since. (Tesseract has gotten a lot better over the years.) Not terribly rarely, I use ocrmypdf to forcibly redo OCR layers because they are unusable. 3. ocrmypdf supports JBIG2, and possibly for other reasons as well, generates smaller PDFs; this is true even for 'native' PDFs or ones with good OCR. I routinely see PDFs I download, hot off the presses just days before with presumably their latest and greatest publishing stack from major scientific publishers, which shrink by a third or a half or sometimes wind up as much as 10x smaller. Not being a PDF expert, I have no idea how they manage to waste so much space, but they manage it. I also found that standard scan tools I was using like imagescan or gscan2pdf or 1dollarscan were not producing as small PDFs as ocrmypdf did. 4. ocrmypdf will also write PDF/A by default. It's true that most PDFs you download or create will probably be perfectly readable 50 years from now with no special effort... But it's nice to have that extra bit of archival compliance.
- gumboshoes 4y agoI agree on all points. I use the following one-liner in directories of PDFs to reduce their file size while retaining dimensions, not hurting readability, and keeping the embedded OCR text in place. It skips re-running the OCR. It's basically a recipe from the docs, I believe. find . -name '*.pdf' | parallel --tag -j 1 ocrmypdf --tesseract-timeout=0 --skip-text --jbig2-lossy --optimize 3 --output-type pdf '{}' '{}-sm.pdf'
- dataflow 4y agoFun fact: even Gmail OCRs image files. If you search for emails using keywords, it'll use the OCR results. I just wish there was a way to get access to the OCRed text.
- hackernewds 4y agoGoogle can do this at scale. Google Lens is amazing, and the swipe up+select on Pixel (stock Android) is amazing. yet with all things Google, so poorly advertised
- tyingq 4y agoNot exactly what you're asking for, but Google Keep has a "grab image text" menu item for any note that has an image in it. I assume it's using the same backend.
- pronoiac 4y agoI think I looked at using Google Drive for OCR, but it was limited to 2 meg files or only a few pages or something? I had a lot of higher resolution pages (1k pages, 300 or 600dpi), so this was a non-starter for me.
- gumboshoes 4y agoAs mentioned in the other replies, Google's automatic OCR is limited. OCRmyPDF is designed for PDFs. So if you download a 1000+ page public-domain dictionary off of Archive.org (which is something I do regularly), and you want to re-run the OCR because Internet Archive doesn't tune its OCR very well for multilingual works (if it all), then OCRmyPDF is going to beat Google's automatic OCR every time. However, I recently paid a programmer to fork OCRmyPDF to give it the option to use Google's OCR engine instead of Tesseract. That fork is here: https://github.com/ualiawan/OCRmyPDF https://github.com/ualiawan/OCRmyPDF. It's more fiddly than the regular OCRmyPDF, and it requires a Google Cloud Vision account (which charges some fraction of a cent for each page OCRed), but it works well, and in some cases may produce better results than OCRmyPDF, although you must be sure to specify the language of the document.
- bkanuka 4y agoVery cool - I'm interested in your(?) fork of OCRmyPDF. But can I ask..Why a fork and not a plugin to OCRmyPDF? which supports adding new OCR backends.