imgrep

command module
v0.0.0-...-95065f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2017 License: MIT Imports: 5 Imported by: 0

README

imgrep

imgrep is a command-line utility in Go to search for keywords found within images.

coverage

Installation

imgrep depends on Tesseract.

  • On Fedora: sudo dnf install tesseract-devel
  • On Debian: sudo apt-get install libtesseract-dev
  • On macOS: brew install tesseract
Prerequisites
Linux:
# Fedora
sudo dnf install tesseract tesseract-devel leptonica-devel golang

# Debian
sudo apt-get install tesseract-ocr libtesseract-dev libleptonica-dev golang
macOS:
  1. Install Go
  2. Install homebrew
brew install tesseract
Get imgrep

Make sure your $GOPATH is set, then run:

# fetch src and install binary
go get github.com/keeferrourke/imgrep
go install github.com/keeferrourke/imgrep

Usage

imgrep like grep, searches file contents for text. Unlike grep however, imgrep searches image files only using Tesseract OCR.

imgrep comes with two interfaces; a CLI as one might expect, and a web-UI graphical front-end.

CLI

To speed up the process on some machines, imgrep can pre-process and index files by keywords found within them. To preindex an entire directory (including subdirectories):

imgrep init # pre-process and index image files in working directory

By default, imgrep uses this database of pre-indexed files to perform simple queries. To check preindexed directories:

imgrep search QUERY

To use imgrep without checking against the database of preindexed files, simply call

imgrep search -n QUERY

Like the grep family of functions, imgrep is useful with Unix-pipes:

# Example: Count the number of images that contain the first line of a
#          plain-text file
head -n1 myfile | imgrep search -n - | wc -l

# Example: Open the first file that matches a search
xdg-open "$(imgrep s learn | head -n1)"

Web UI

See imgrep-web.

License

imgrep is free software licensed under the MIT license.

Copyright (c) 2017 Keefer Rourke and Ivan Zhang.

See LICENSE for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL