Difference between revisions of "Tesseract"
(→searchable PDF using Tesseract) |
m |
||
Line 2: | Line 2: | ||
You will likely require the convert tool from imagemagick to be successful in using tesseract. | You will likely require the convert tool from imagemagick to be successful in using tesseract. | ||
+ | |||
+ | |||
===installation and basic usage=== | ===installation and basic usage=== | ||
Line 20: | Line 22: | ||
This will not directly accept PDF in the fashion as described above. | This will not directly accept PDF in the fashion as described above. | ||
+ | |||
+ | Sometimes tesseract works better if the image is bigger, sharper, or has higher contract. Using a combination of imagemagick and tesseract we can get a more accurate OCR text file. | ||
+ | convert -colorspace gray -fill white -resize 480% -sharpen 0x1 documentpage01.png documentpage01.jpg tesseract documentpage01.jpg documentpage01.txt | ||
===graphical front end=== | ===graphical front end=== |
Revision as of 10:51, 3 October 2019
Tesseract is capable of taking images of many different formats like jpg, png, tiff, etc and extracting text from it. Tessereact is considered one of the best OCR tools and was developed by Hewlett Packard in C and C++ in 1985 and has been improved constantly since that time.
You will likely require the convert tool from imagemagick to be successful in using tesseract.
installation and basic usage
To install Tesseract OCR on linux mint:
sudo apt install tesseract-ocr
which automatically does this for you: apt install tesseract-ocr-eng
Syntax:
tesseract imagename outputbase [-1 lang] [-psm pagesegmode] [configfile...]
To process a PDF file and output OCR'd text to the screen
tesseract document.png stdout
To process a PDF file and output OCR'd text to a text file
tesseract document.png document.txt
This will not directly accept PDF in the fashion as described above.
Sometimes tesseract works better if the image is bigger, sharper, or has higher contract. Using a combination of imagemagick and tesseract we can get a more accurate OCR text file.
convert -colorspace gray -fill white -resize 480% -sharpen 0x1 documentpage01.png documentpage01.jpg tesseract documentpage01.jpg documentpage01.txt
graphical front end
gImageReader is a simple GTK+ front-end to tesseract-ocr.
sudo apt install gimagereader
searchable PDF using Tesseract
Using the command line the process of turning a non-searchable PDF such as one created by the process described in Create PDF Documents with ImageMagick and Ghostscript into a searchable PDF will be described here. It is possible, but a little complicated.
tesseract document01.png out PDF tesseract document02.png out PDF tesseract document03.png out PDF
Page 1, Page 2, and Page 3 all made out to searchable PDF. However, we want them all in one PDF