Jump to content

Extract text from PNG file

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
iqessar

iqessar

    Newbie

  • Members
  • Pip
  • 6 posts
I have a requirement at work to extract text from a set of PNG files.

The PNG files are generated with stats , for example:

Service Level:

Good: 94%
Marginal: 34%
Failure: 20%

All I need is to extract the percentages and display/write to file or screen.

I have looked at this and failed miserably. I decided to write a batch file which scans through each PNG file, converts to PNG using PICTVIEW and IMAGEMAGICK.

PICTVIEW kept gaving me a blue screen of death, understandibly because its an old DOS app. IMAGEMAGICK requires a payment so thats out of the window.

The problem is that I am only able to write batch files or use VBSCRIPT. I dont need the code writtten to me on a plate, I just advise on any libraries or methods to do what I need to do. At the moment I`m having to go through each PNG file, make a note of the percentages, and manually type them into an excel file. What is needed is some method to extract the percentages and may be copy them to a file or screen, I dont mind copying all the values and then pasting them into excel.

All help and advise would be appreciated.

many thanks

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
You'll need a simple OCR library to work with this, how else would you read a hunk of pixels as a usable string? This may require a more advanced language unless a library provides a command line accessable API.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
PNGs are binary files. They do not actually contain text, just pixels. It would be like trying to learn how to build a space shuttle by looking at a picture of one. Tell your boss or whatever that he/she doesn't know anything about computers and should consult you on whether a goal is realistic instead of just frivolously assigning it. There are technologically illiterate people who ask for all kinds of crazy $hit. Take these for instance.