How to get text in png file using Java

I want to check if particular string is present in the image. Is that possible? Is pngj can do that?

My file will contain a graph and some legends. I want to check the if the legends are correct.


  • No, you can't do that with pngj. The text that is visible in the PNG image is not internally stored as text. You will need OCR software if you wish to identify the text.

    However it would be much better if you could get the data in another format that is easier to parse by a computer.