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 was curious to know if ImageMagick can detect numbers in an image? What is the best way to code for this if it can be done? If ImageMagick cannot do it is there another way to detect numbers on an image?

EDIT: Im not looking for an OCR program or to use an OCR program. I have used OCR through acrobat and if it is a unique truetype or opentype font the OCR process will destroy the image.

share|improve this question
up vote 5 down vote accepted

ImageMagick transforms images, it does not recognize them. Of course you could whip up something that does, e.g. by comparing the image you have with images with known numbers. As an alternative to ImageMagick, an OCR software like gocr or similar might apply. It depends a lot on what the image actually looks like.

If the number you're looking for is a date or timestamp, you find such info often in the EXIF data - if the image is a JPEG photograph.

For a more specific answer you need to provide a more specific question.

share|improve this answer
that's just it I'm looking for any numbers that may be added to images. Such as pricing or bar codes but I could never say EXACTLY what to look for because they are all different. I've seen ImageMagick samples that can alter objects. Plus I don't want to manipulate the Image with an OCR program all I want to do is DETECT it. – Darth_Vader Feb 4 '13 at 17:57
@graphicsman. You've got it backward. ImageMagick manipulates images and OCRs detect characters in images (optical character recognition). – Stéphane Chazelas Feb 4 '13 at 19:09
@graphicsman: If you want to read barcodes from images you could try zbar – donothingsuccessfully Feb 4 '13 at 19:12
@StephaneChazelas Ive used Acrobat OCR to know that when you OCR the image it can destroy the image but I know it detects type and converts accordingly. Im not looking to use OCR to change the image. I do understand what ImageMagick does. – Darth_Vader Feb 4 '13 at 19:29
What you're looking for is essentially artificial intelligence. Well, OCR was a field of artificial intelligence until someone actually wrote a software sufficiently complex to handle it somewhat reliably within well defined parameters (such as black text on a white page without distortions). Even smartphones able to recognize text and characters and barcodes you photograph usually need to know that you're currently photographing such a thing. So that's human-assisted software, the information that there's a barcode there is supplied by you. – frostschutz Feb 4 '13 at 20:26

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.