# Amharic Image Text Comparison & Correction Tool
This tool provides a full workflow for extracting Amharic text from images, comparing text layouts and content, rendering corrected text, and visualizing layout/text differences.
It is ideal for OCR research, document verification, and Amharic text QA.
## Features
- **OCR Extraction:** Accurate Amharic text and layout extraction from images using Tesseract.
- **Text Reconstruction:** Rebuilds text with original line and word spacing.
- **Comparison:** Detects and visualizes line-by-line and word-by-word differences (including spacing).
- **Font Rendering:** Renders Amharic text to images with Abyssinica SIL font.
- **Visual Diff:** Highlights spacing errors, word mismatches, and corrections directly on images.
- **Modular Scripts:** Easy to run step-by-step or integrate as a pipeline.
## Directory Structure
```
amharic-image-diff/
├── README.md
├── requirements.txt
├── ocr_extract.py
├── compare_texts.py
├── render_text.py
├── visualize_diff.py
└── fonts/
└── AbyssinicaSIL-Regular.ttf
```
## Setup
1. **Install Python dependencies**
```sh
pip install -r requirements.txt
```
2. **Install Tesseract and Amharic language pack**
```sh
sudo apt-get update
sudo apt-get install tesseract-ocr tesseract-ocr-amh
```
3. **Download Abyssinica SIL font**
```sh
mkdir -p fonts
wget -O fonts/AbyssinicaSIL-Regular.ttf
github.com
```
## Usage
### 1. OCR Extraction
Extract Amharic text from an image and reconstruct the layout:
```sh
python ocr_extract.py --image --output
```
### 2. Compare Texts
Compare two text files line-by-line, showing all layout and character differences:
```sh
python compare_texts.py --original --new
```
### 3. Render Text to Image
Render a text file back to an image using Amharic font:
```sh
python render_text.py --input --output --font fonts/AbyssinicaSIL-Regular.ttf --size 28
```
(Font size is customizable.)
### …