{"id":28103304,"url":"https://github.com/mrigank005/ocr","last_synced_at":"2025-06-18T08:38:22.119Z","repository":{"id":291185878,"uuid":"976873442","full_name":"Mrigank005/OCR","owner":"Mrigank005","description":"This Python script automates the extraction of text from images using Tesseract OCR. It processes all images in the test_images/ folder and saves the extracted text as .txt files in the extracted_texts/ directory, maintaining the original image filenames.","archived":false,"fork":false,"pushed_at":"2025-05-02T23:27:11.000Z","size":344,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T20:28:08.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mrigank005.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-02T23:09:16.000Z","updated_at":"2025-05-02T23:27:14.000Z","dependencies_parsed_at":"2025-05-03T00:20:56.589Z","dependency_job_id":"57e6776e-b21a-4215-a627-3bb06714df95","html_url":"https://github.com/Mrigank005/OCR","commit_stats":null,"previous_names":["mrigank005/ocr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mrigank005/OCR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrigank005%2FOCR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrigank005%2FOCR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrigank005%2FOCR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrigank005%2FOCR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mrigank005","download_url":"https://codeload.github.com/Mrigank005/OCR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrigank005%2FOCR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260520968,"owners_count":23021718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-13T20:27:37.624Z","updated_at":"2025-06-18T08:38:17.108Z","avatar_url":"https://github.com/Mrigank005.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖼️ OCR Text Extractor\n\nThis Python script automates the extraction of text from images using Tesseract OCR. It processes all images in the `test_images/` folder and saves the extracted text as `.txt` files in the `extracted_texts/` directory, maintaining the original image filenames.\n\n---\n\n## 📁 Project Structure\n\n```\n\nOCR-Text-Extractor/\n├── OCR.py\n├── test_images/\n│   └── image1.jpg\n│   └── image2.png\n├── extracted_texts/\n│   └── image1.txt\n│   └── image2.txt\n└── README.md\n```\n\n\n\n---\n\n## ⚙️ Features\n\n* Batch processes `.jpg`, `.jpeg`, and `.png` images.\n* Supports multiple languages (default: English and Hindi).\n* Automatically creates the `extracted_texts/` folder if it doesn't exist.\n* Provides informative logging for each processed file.([GitHub][2])\n\n---\n\n## 🚀 Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Mrigank005/OCR\ncd OCR\n```\n\n\n\n### 2. Install Dependencies\n\nEnsure you have Python 3 installed. Then, install the required Python libraries:\n\n```bash\npip install pillow pytesseract\n```\n\n\n\n### 3. Install Tesseract OCR Engine\n\n* **Windows**: Download and install from [Tesseract OCR Windows Installer](https://github.com/tesseract-ocr/tesseract/wiki).\n* **macOS**: Use Homebrew:([GitHub][1])\n\n  ```bash\n  brew install tesseract\n  ```\n\n\n\n* **Linux (Debian/Ubuntu)**:\n\n  ```bash\n  sudo apt-get install tesseract-ocr\n  ```\n\n\n\nEnsure Tesseract is added to your system's PATH.\n\n### 4. Add Images\n\nPlace the images you want to process into the `test_images/` directory.\n\n### 5. Run the Script\n\n```bash\npython OCR.py\n```\n\n\n\nThe extracted text files will be saved in the `extracted_texts/` directory.\n\n---\n\n## 📝 Customization\n\n* **Language Support**: The script defaults to English and Hindi. To modify the languages, edit the `langs` parameter in the `extract_text_and_save` function within `OCR.py`:\n\n  ```python\n  def extract_text_and_save(image_path, langs=[\"eng\", \"hin\"]):\n  ```\n\n\n\nRefer to [Tesseract OCR Language Data](https://github.com/tesseract-ocr/tesseract/blob/main/doc/tesseract.1.asc#languages) for available language codes.([GitHub][1])\n\n* **Tesseract Path**: If Tesseract isn't in your system's PATH, specify its location in `OCR.py`:\n\n  ```python\n  import pytesseract\n  pytesseract.pytesseract.tesseract_cmd = r'/path/to/tesseract'\n  ```\n\n\n\n---\n\n## 🧪 Sample Output\n\nFor an image named `page1.jpg` in `test_images/`, the script will generate `page1.txt` in `extracted_texts/` containing the recognized text.\n\n---\n\n## 🙌 Acknowledgements\n\n* [Tesseract OCR](https://github.com/tesseract-ocr/tesseract)\n* [pytesseract](https://pypi.org/project/pytesseract/)\n* [Pillow](https://pypi.org/project/Pillow/)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrigank005%2Focr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrigank005%2Focr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrigank005%2Focr/lists"}