imgrep — a grep for images
What is this?
imgrep is a command-line utility written in Go. Much like
grep, it searches for text snippets within image files using Tesseract OCR.
imgrep comes with two inferences; a CLI that follows Unix software philosophies, and a web-UI graphical front-end.
# Fedora sudo dnf install tesseract-devel leptonica-devel golang # Debian sudo apt-get install tesseract-ocr libtesseract-dev libleptonica-dev golang # macOS brew install tesseract
Get and install
go get -u github.com/keeferrourke/imgrep go install github.com/keeferrourke/imgrep
imgrep is a command line utility. Somewhat like
grep, it searches for text within images using OCR extracted text as the search haystack.
Because OCR is a slow process for many files on some machines,
imgrep pre-processes and indexes files by keywords in a sqlite database found at
$HOME/.imgrep/imgrep.db. To add a directory to the database, run:
To check preindexed directories (ignoring case specifiers):
imgrep search -i QUERY
This effectively pays for processing time in advance so results are returned quickly. In the case you don't want to pre-index a directory, you can run a search as follows:
imgrep search -n -i QUERY
Note this might take a long time (a few seconds to several minutes) And hence preindexing directories is highly recommended.
There is an optional web interface available. You can install it by:
go get -u github.com/keeferrourke/imgrep-web go install github.com/keeferrourke/imgrep-web
Start a server on localhost:1337 by running
imgrep-web server &
Then just visit localhost:1337 in your favourite browser
imgrep is written by Keefer Rourke and Ivan Zhang. The
imgrep-web server was written by Keefer Rourke and Ivan Zhang. The web-ui front-end was written by Thomas Dedinsky and polished by Ivan Zhang.
imgrep is free software released under the MIT license. See LICENSE for details.