Skip to main content

Grep for text in images

Project description

Upload to PyPI License

IMGrep

Want to find that one meme with the funny punchline? Looking for a picture of a PowerPoint presentation on a specific topic, that you took 5 years ago? IMGrep might help.

It works like grep, but for images, and with a lot less features ... and it's also much slower ... and not suuuper accurate ;D

IMGrep is built on the Tesseract-OCR-Engine and uses pytesseract for the bindings.

Install

You can install imgrep from PyPI with pip

pip install imgrep

Usage

Get the usage with imgrep -h.

usage: imgrep [-h] [-i] [-r] [-f] [-0] pattern file

Grep for text in images.

positional arguments:
  pattern               A Python regex, to search for.
  file                  Path of the image(s) to search through. (Or folder(s), if `--recursive' is specified).

options:
  -h, --help            show this help message and exit
  -i, --ignore-case     Ignore case distinctions in patterns and input data.
  -r, --recursive       Grep through every file under a given directory.
  -f, --filenames-only  Only print the file names, not the contents. Makes no sense without `--recursive', and will be ignored if `--recursive' is not specified.
  -0, --null            Print the output seperated by null characters, this is useful for badly named files. Makes no sense without `--filenames-only', but will be done regardless, if specified!

Be patient. It uses multiple cores, but this just takes a while. Searching for a specific string in my ca. 2000 image strong memes folder took about 8 minutes and 30 seconds.

Performance

Is abysmal. You've been warned.

Neither accuracy, nor execution time are that great, but it works for my use case. And it is still much faster, than combing through my photos one by one, when I'm looking for something specific.

TODO

  • Having -a and -b flags to include N lines of output after, and before the match would be nice.
  • Also coloring the output on smart terminals would be cool.
    • That opens a whole can of worms with determining whether the terminal supports it or not.
    • Or whether the user wants color (NOCOLOR, or TERM=dumb etc.?).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imgrep-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

imgrep-0.0.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file imgrep-0.0.2.tar.gz.

File metadata

  • Download URL: imgrep-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for imgrep-0.0.2.tar.gz
Algorithm Hash digest
SHA256 882d7051e36b6f23f22f6b37e81ca3dc77695cce0e6ec8e8aad9c6b954e40d13
MD5 36ea31f4dac9291060111c7fb3cb2732
BLAKE2b-256 4c99585c7bd8a8e9cea85a17554b4e3d20d210028785cc97d17633ac27bb52bd

See more details on using hashes here.

File details

Details for the file imgrep-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: imgrep-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for imgrep-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be32bee499962ffeea82b0f2c395f75b0807f4b813cf2805591e34595647f978
MD5 e3b3ada3f1fcee7c1aa0b67ab66904ae
BLAKE2b-256 bb88a8d0d8a7a8b21aaeae062ee5a7f586b927bdc1398004def5240811b4f717

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page