Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got a lot of images, and I need to find, which of them contain any text in English (to delete them). Is it possible to do it automatically?

share|improve this question
"To delete them", that could be massive task, the program need to recognize the texts, fill in the missing background color – warl0ck Oct 18 '12 at 6:58
"to delete them" - to delete images, not the text – Andrey Chetverikov Oct 18 '12 at 19:37
up vote 2 down vote accepted

You could use an open source OCR engine, say Tessaract, in order to figure out is there an english text or not.

share|improve this answer
Thanks, I understand the general idea that I need to use OCR, the question is - how to do it? Can tesseract return yes/no for each image? Or do I need to put text into file, and then analyze the created files? – Andrey Chetverikov Oct 18 '12 at 19:40
Image -> OCR -> text file. – akond Oct 19 '12 at 6:19

I had the same problem, sharing my solution:

find . -type f \( -name "*.jpg" -or -name "*.png" \) -exec sh -c 'for x; do printf "%s :" "$x"; tesseract $x temp; if (grep -f blacklist temp.txt) then rm $x; rm temp.txt; fi; done' _ {} +

scans all subdirectories and deletes matching OCR patterns according to a file named "blacklist". only problem: if there is a space in file, it doesn't parse it correctly and instead tries to run on the first word of the file.

edit: careful not to leave any blank lines on the blacklist file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.