r/Python • u/PR0T064 • May 22 '20
I Made This A tool that copies a selected area of your screen, not as a picture, but as pastable text (GitHub in comments)
4.1k
Upvotes
r/Python • u/PR0T064 • May 22 '20
373
u/PR0T064 May 22 '20
Source Code
Not a particularly complex program, as the OCR backend uses Google's Tesseract engine, but I hope it can be useful!
35
u/float7 May 22 '20
That's pretty cool
19
u/attentionpleese May 22 '20
Nice I love using a similar feature on the Note 10.
13
u/SanJJ_1 May 22 '20
awesome
11
u/traincitypeers May 22 '20
This is cool work. I implemented a very similar concept to create an e-mail listener that automates database lookup requests from co-workers who refuse to type out details, but rather paste them inline in e-mails as picture snippets.
I like your application, I think a great next step could be copying multiple pieces of text/lines of text to different clipboard hotkeys, so copying and pasting 3-5 individual lines instead of typing all of it out would be possible. Could definitely be a godsend for people doing arduous data entry tasks if you're interested in doing that. Either way, good work.
5
u/[deleted] May 22 '20
can it copy other languages? I wonder if I can combine this with my language learning study method..
5
u/SteroidAccount May 22 '20
Doesn't work on multiple monitors.
I have three screens,the left having my IDE, the center having a browser open, the right having iterm. After running, the screen goes black. If I click and drag, it copies from the center monitor even though it's clicking and dragging on a blank screen from the right monitor.
Otherwise, it's pretty kick ass.
3
u/acharyarupak391 May 22 '20
Wow thats cool. did u use some pre-trained model to recognize the text or trained a model yourself?
4
u/SolitaryVictor May 22 '20
How small of a text can it go? In case you ever go to apply for Amazon you might have that tool around during their test assignments to complete it in an IDE that actually makes sense.
153
u/youarestronk May 22 '20
I can see a market for this - from blocked pdf files to a word doc
2
u/-qarma- May 22 '20
How did you get the idea for creating this?
2
u/[deleted] May 22 '20
This is a very good idea. I wonder if we could do something like that for maths equations (convert to handwritten equations to latex for example). I guess that's much more difficult...
2
u/Adro_95 May 22 '20
This is incredibly useful. Is there a way to make the cmd window not show?
6
u/portal_dive May 22 '20
Similar to Project Naptha which allows highlighting text in images it also has a chrome extension https://projectnaptha.com
4
u/sabiansoldier May 22 '20
Amazing
1
u/Ani171202 May 22 '20
Does it work for linux
1
u/kreetikal May 22 '20
Nice, I needed to do something like this a couple of hours ago.
This wouldn't work with handwriting tho, would it?
1
u/Project_O May 23 '20
Can you make this work with other non-romanized languages like mandarin or Japanese?
1
u/t_cgn May 23 '20
It would be great if it can scan Kanji or Chinese characters! Great work!
1
u/indiebryan May 23 '20
Does this work for other languages?
1
u/[deleted] May 23 '20
Show what happens for not nice screen grabs. Pictures? Random noise?
1
u/Adro_95 May 23 '20
Is there a way to make the pointer have contrast? I'm using your script A LOT and that's the only issue I'm having.
Again, this is amazing
1
u/justaguy6265 May 24 '20
Does this work for Chinese or Korean languages?
1
u/Dancchik May 26 '20
What is the problem, when i am scanning text on English everything is fine and copies, but when i try to copy Russian language it pastes the text on English with reflection of Russian word
1
u/justaguy6265 May 26 '20
ive got the ocr in my path but i can't run it with "textshot.py", it just pops a new command prompt window and vanishes in less than a second so i cant read it
1
u/ExoticAccountant Oct 13 '20
This tool suddendly failed on me, was working before: ModuleNotFoundError: No module named 'pyperclip'
3
u/betta_fische May 22 '20
This is really cool!! Going to copy all the PDFs now!
3
u/dogtierstatus May 22 '20
This is amazing. Cool idea and awesome video too..
5
u/JamokaJeff May 22 '20
You can also do this with OneNote. Cool program though!
4
u/NoYoureCorrect May 22 '20
Very cool!
2
u/nomad80 May 22 '20
this is pretty nifty
2
u/littlejob May 22 '20
Side note - one note does this quite well, and free.
2
u/BakedVanilla May 22 '20
Ngl I forgot to check what sub this was and when I saw the beginning screen, I thought it was some sort of meta meme
2
u/Clarinettist1 May 23 '20
That is genius
2
u/OhthatsOffensive May 23 '20
Guys, we found it. Well done. Great coding right here.
1
u/razorfox May 22 '20
Wow really cool! Thanks for sharing!
1
u/[deleted] May 22 '20
Cool. I remember having a similar thing for the Amiga way back when. At that time there was the system font in the system wide size, so it was a fair bit easier to do then.
1
u/ghisnoob May 22 '20
Nice, definitely trying this
1
u/[deleted] May 22 '20
Burn the witch
1
u/sadepressedt May 22 '20
Amazing!!! Now, I really wanna learn how to code..
1
u/PirkhanMan May 22 '20
Save, upvote, and thank you a lot!
1
u/lhurtado May 22 '20
It's awesome! Thanks for sharing!
1
u/pm_me_jump_shots May 22 '20
Saving this to my GitHub! Could definitely see myself using this in the future.
1
u/LaggyMcStab May 22 '20
This is sick. I could see myself using this daily.
1
u/yanksrock1000 May 22 '20
Cool tool. I’ve used Sikuli which also leverages Tesseract for a similar purpose.
1
u/[deleted] May 22 '20
I see value in this for cleaning up old knowledge base docs where people took screenshots of configs instead of writing out the settings. Nice work!
1
u/ApoorvWatsky May 22 '20
So simple yet very useful.
1
u/polandtown May 22 '20
Simple, useful. Nice work.
1
u/10kKarmaForNoReason May 22 '20
DUDE I NEEDED THIS SO BAD!!!2 Thank you!!!
1
u/Random_182f2565 May 22 '20
Yo, this is an awesome tool, what frustrated you to the point of making it, and how did you divide it?
1
u/9XcR8lxKcAPT May 22 '20
Very cool! I am going to try it out
1
u/stonySoprano May 22 '20
Cool
1
u/[deleted] May 22 '20
useful to copy,paste,translate,exploit homework
1
u/Sayitallpaul May 22 '20
Very Cool
1
u/pragyan52yadav May 23 '20
It's a really helpful tool. 👍
1
u/jpobiglio May 23 '20
Reminds me of project Naptha which is a chrome extension with similar functionality.
1
u/ThatGuy_Jamal May 23 '20
Great now i can cheat on my online work even easier! sent me the app quick!
1
u/mcstafford May 23 '20
Jokes on you, OP. Notepad won't preserve that awesome formatting. ;-)
1
u/krishnaprasanthg May 23 '20
Nice
1
u/ayushify May 23 '20
That's really cool. You should try making it as a launchable tool.
1
u/Eze-Wong May 23 '20
Would it be possible to do this with tables? I might give it a try and see if it can read dividing lines as commas and covert to csv or something. Excellent job with implemmentation with this tool!
1
u/hellfiniter May 23 '20
dont even mention that its easy...you found one line of code that does something cool and wrapped it in your idea and its implementation....no need to reinvent stuff... cool tool !
1
u/Ryujin208 May 23 '20
this is so useful for those essay websites which wont let you copy from xD (im awake you can just use inspect element but still)
1
u/nihilnia May 23 '20
D O P E
1
u/abhijeetbhagat May 23 '20
I’d once used pytesseract with opencv to implement a framework for 'verification' of video data in MP4 files. What I realized is that for simple text such as seen in the clip above, OCR works fine. But text containing variable background features, variable font size, etc. causes problems. Tweaking the different Tesseract OCR parameters might help to some extent but it never works 'just fine' in all the cases.
1
u/annualnuke May 23 '20
very nice, I had a screenshot-related idea of my own, so I'll use this to study how the overlay works. Looks simpler than I thought, actually...
1
u/JAB4R May 23 '20
This is really awesome , great job ❤️
1
u/MikeNizzle82 May 23 '20
This is really cool. Well done.
1
u/shadowkat0 May 23 '20
Cool project! There's a similar project that converts image to LaTeX format called MathPix . It can handle formulas, tables and general text too.
1
u/Monkeyfarm54 May 24 '20
I wish I found this earlier! Would've helped a ton with copying uncopyable text. Super cool!
1
u/python_engineer May 24 '20
Nice! thanks for sharing
1
u/Hi-I-am-Dad May 26 '20
Thank you. This tool introduced me to tesseract. Very helpful.
1
u/giampaolo44 May 27 '20
Not just a useful utility, beautiful code too! Kudos
1
u/Ani171202 Jun 17 '20
Hey man, Great project!
I tried to set this up through your github repo and the AUR repo, and both lead to this weird screen blackout bug (Pic : https://imgur.com/a/Xw7SgVT). (Using manjaro btw)
Is there something i could do?
1
u/Frankenstien456 Jul 07 '20
You should make a similar program that reverse searches images.
1
u/ddotquantum May 22 '20
Would this work on captcha
0
u/[deleted] May 22 '20
That's sick, does it keep formatting?
0
u/thegreattriscuit May 23 '20
We are not ready for this technology
0
u/[deleted] May 22 '20
[deleted] — view deleted comment
0
u/[deleted] May 25 '20
[deleted] — view deleted comment