Code Image to Text Converter
Convert code image into text.
For example, if you want to extract code from the image named images/carbon.png
.
Type:
python -m image_converter images/carbon.png .py
This will convert the image to text like below and save the code to the file named carbon.py
.
class DataLoader:
def __init__(self, data_dir: str):
self.data_dir = data_dir
print("Instance is created")
def __call__(self):
print("Instance is called")
data_loader = DataLoader('my_data_dir')
data_loader()
Installation
Intall Tesseract
- Linux
sudo apt-get update
sudo apt-get install tesseract-ocr
sudo apt-get install libtesseract-dev
- Windows Install from here
Install code-image-to-text
pip install code-image-to-text