r/programming • • Mar 26 '21

How to extract text from image in Python

https://hinty.io/vserhiyev/how-to-extract-text-from-image-in-python/
132 Upvotes

15 comments sorted by

69

u/meem1029 Mar 26 '21

"Hey, there's a library that does this thing" doesn't feel like a very substantial article for r/programming. It's not even a particularly well written article (why is there a random "Convert to pdf" section at the bottom? What sorts of "boxes, confidences, line and page numbers" are presented or how do I use them?)

9

u/[deleted] Mar 26 '21

I'm afraid the reality is that are there many such articles/videos/projects being posted to r/programming every day. Occasionally there are articles that are so bad that there is no upvote or comment at all -- I guess people do not even bother to criticize.

9

u/meem1029 Mar 26 '21

In this case the article had 150 upvotes in 30 minutes which made me intrigued, but given the content and lack of discussion I suspect it's just bought upvote blogspam.

2

u/vriemeister Mar 26 '21

Geeze, you aren't wrong. The article is basically "use tesseract" and two lines of code. Thanks for nothing.

import pytesseract  
print(pytesseract.image_to_string('test.png'))

2

u/AttackOfTheThumbs Mar 26 '21

It's likely an alright article for beginners, or someone just needing the capability, but yeah, it's all wrong for this sub, and just reeks of self promotion.

Just look at the "positive" comments.

1

u/elebrin Mar 26 '21

It doesn't even have comparisons with other libraries that do the same thing. I find it interesting, but they talk about none of the market leaders for OCR and why you should pick this one over them.

18

u/[deleted] Mar 26 '21

Are the upvotes and comments bought? Why is this getting attention?

1

u/lazerflipper Mar 26 '21

had the same thought. this thread feels like a shitty attempt at social media marketing.

7

u/rtzll Mar 26 '21

super useful tool to capture text from a screenshot: https://github.com/ianzhao05/textshot

(also written in Python and using pytesseract)

1

u/ITChristian21 Mar 26 '21

Unfortunately, tesseract documentation is not well explained regarding its advanced features, like training new fonts. But it is a very great tool.

-15

u/dihangyddlq Mar 26 '21

Saved to bookmark, nice staff

-17

u/gootecks Mar 26 '21

omfg I can't believe it was that easy, WTF O_O

thanks OP!

5

u/itsgreater9000 Mar 26 '21

it's not, this is a really basic tutorial about the pytesseract (really, tesseract) API. if you want to do anything that is more complicated than what OP used (either because your picture is a mess, or you have a non-standard font, or hopefully it's not using latin letters, etc.) you will need to dig deeper.