How can I read text on the screen presented as an image using sikulix IDE?

1.8k views Asked by At

I'm using sikulix IDE version 2.0.5 in windows 10 and the usage so far is successful.

I want to read a specific single line text on the screen using sikulix IDE. I can't copy the text to the clipboard because it on an image.

I'm able to do this on eclipse IDE using Tesseract and tess4j in Java after I imported its jar.

With my project I'm looking to use sikulix IDE because I found it to be reliable in reading images.

My question now is how can I read the text on the screen presented as an image using sikulix IDE? Is there a method I can use within the sikuli IDE.

Can someone guide me!

Thank you.

1

There are 1 answers

1
RaiMan On BEST ANSWER

text = Image.create("givenImage.png").text()

If you want to read from only part of the image:

text = Image.create("givenImage.png").getSub(x, y, w, h).text()

where x and y are counting from the top left corner of the image as (0, 0).

Example for top of image:

img = Image.create("givenImage.png")
text = img.getSub(0,0,img.w, 20).text()

RaiMan from SikuliX