Python Live Coding - OCR with Tesseract and PIL to display text screenshot in full on Twitter

Опубликовано: 11 June 2026
на канале: Coding with Indy
370
3

Ever so often when I want to post some screenshot of a block of text on Twitter, it doesn't display properly because of the weird aspect ratio of the screenshot.

In this video, I use Tesseract to extract text from the screenshot image, and re-render it on an image with correct aspect ratio, in full. I use Google Colab Python environment. You can learn how to load data into and out of the Colab environment, and display images in a cell.

This is a short script where I used Tesseract and PIL to get this done.

Code in Colab Notebook here:
https://colab.research.google.com/dri...

Music:
Palmtrees - The Brothers Records    / @donguyrockwell  
Wild Pogo - Francis Preve
   / @francispreve  
Nimbus - Eveningland
   / @eveninglandmusic  
Clean Bread - Density & Time
   / @goldenpalmrecorders