Amharic OCR REST API built with C# - Extracts text from images using optical character recognition for Ethiopian Amharic script.
# Amharic OCR API (C#)
## Tags
**Topics:** `OCR`, `Amharic`, `C#`, `ASP.NET Core`, `IronOCR`, `Serilog`, `Swagger`, `REST API`, `PDF`, `Image Processing`
A robust RESTful API for extracting Amharic text from images and PDF files using IronOCR, built with ASP.NET Core.
## Features
- Extracts text from images (JPG, PNG, GIF, TIFF, BMP) and PDFs
- Preprocessing for improved OCR accuracy (deskew, denoise, enhance resolution)
- Structured logging with Serilog (console, file, and centralized with Seq)
- Monitoring and alerting with Application Insights
- Authentication and authorization with JWT Bearer tokens
- File upload validation (type, size)
- HTTPS enforcement and CORS policies for security
- Consistent, structured API responses
- Swagger UI for interactive API documentation and testing
- Secure configuration (no hardcoded secrets)
## Getting Started
### Prerequisites
- .NET 8 SDK
- IronOCR License Key (trial or production)
### Setup
1. **Clone the repository:**
```sh
git clone
github.com
cd amharic-ocr-api-csharp
```
2. **Restore dependencies:**
```sh
dotnet restore
```
3. **Configure environment variables:**
- Copy `appsettings.template.json` to `appsettings.json` and fill in your values, or set environment variables:
- `IronOcr__LicenseKey`: Your IronOCR license key
- `Seq__Url`: Seq server URL (e.g., `
localhost` for development)
- `ApplicationInsights__ConnectionString`: Azure Application Insights connection string
- `Jwt__Key`: A strong secret key for JWT signing (at least 256 bits)
- For development, you can use User Secrets: `dotnet user-secrets set "IronOcr:LicenseKey" "YOUR_KEY"`
- In production, set these as environment variables in your deployment platform (Azure App Service, Docker, etc.)
4. **Build the project:**
```sh
dotnet build
```
5. **Run the API (Development mode):**
```sh
$env:ASPNETCORE_ENVIRONMENT="Development"
dotnet run
```
## API Usage
### Endpoint: `POST /api …