close menu

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.



sudo dnf install tesseract-devel leptonica-devel golang                      # Fedora
sudo apt-get install tesseract-ocr libtesseract-dev libleptonica-dev golang  # Debian
brew install tesseract                                                       # macOS

Get and install

go get -u
go install


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:

imgrep init

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.

Web UI

There is an optional web interface available. You can install it by:

go get -u
imgrep search -n -i QUERY
go install

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.