0

I have a text document which is in image format (PNG FILE). I want to manually highlight each sentence in that image programmatically using javascript/css. I want to use this technique on web page. Is there any idea to do that?

3
  • That's far from being trivial (if possible at all). You'll need an OCR program, for starters. Commented Jan 28, 2013 at 17:25
  • As far as I'm aware, you can't actually access the content of an image via JavaScript, so I don't think it would be possible using JavaScript. Commented Jan 28, 2013 at 17:26
  • @Brendan It's possible using the <canvas> element. But probably not very efficient. Commented Jan 28, 2013 at 17:29

1 Answer 1

2

You would need to do some server-side processing with OCR to detect the location within the image where sentences start/end. Once you know that, you could use javascript and CSS to place styled divs over the image.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the reply. On server-side I am already converting text to image but I don't have idea how to keep track of location because one image can have 10 sentences and may be some sentence will be on multiple lines. How to keep its track and then create divs accordingly.
Why not re-assess your approach. Do you really need to send back an image? Why can't you send back text and style it up regularly?
Its because of using different font and non-english language which mobile devices doesn't support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.