You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a Python 3 program that performs two operations:
Generate an image with user-specified text.
Extract the text from the generated image using OCR.
Functionality
The script should accept two command-line arguments:
A string of text to embed in the image.
A filename for the generated image (e.g., output.png).
It should generate an image with a white background and black text using the Pillow library.
It should then immediately run OCR on the image using pytesseract and print the extracted text to stdout.
Example Usage
python text_ocr.py "Hello from GitHub Copilot!" test.png
Generated image: test.png
Extracted Text:
----------------
Hello from GitHub Copilot!
Requirements
Use the following libraries: pip install Pillow pytesseract