A powerful, Django-based web application for automated manga translation. This is a forked and enhanced version of georgescutelnicu/Manga-Translator.
Unlike the original repository, which primarily handles local files, this fork introduces the ability to translate directly from any manga website URL using its integrated scraping engine.
- Automated Detection: Uses YOLOv8 to precisely locate text bubbles in manga pages.
- State-of-the-Art OCR: Leverages
manga-ocrfor high-accuracy Japanese text recognition. - Stable Translation: Optimized support for Google Translate and Microsoft Bing Translator.
- Modern UI/UX: Custom-built, high-performance vanilla CSS/JS interface with animated transitions and a simulated progress tracking system.
- Smart Scraping: Integrated
cloudscraperto bypass Cloudflare and anti-bot protections on popular manga sites. - Image Enhancement: Integrated 2x Lanczos upscaling (Super-Resolution) to improve OCR accuracy for small text and furigana.
- Professional Logging: Structured logging with
loguru, featuring file rotation and retention. - Dynamic Cleanup: Automatically manages temporary files and translated images to save storage.
- URL-Based Translation: Translates directly from manga chapter URLs (Scraping engine).
- Premium UI Overhaul: Replaced standard Bootstrap with a bespoke, mobile-friendly modern design featuring deep indigo accents.
- Fault-Tolerant Pipeline: Implemented resilient error handling that prevents application crashes during individual translation failures.
- Robust Scraper: Added fallback to
cloudscraperfor sites like RawKuma. - OCR Optimization: Implemented image upscaling logic that significantly improves recognition of small characters.
- Furigana Handling: Optimized preprocessing specifically to capture small reading aids (furigana).
- Production Logging: Integrated a centralized logging system with file outputs for easier debugging.
- Chained Translation Fallback: Automatically switches between translation services (Google/Bing) if one fails or is rate-limited.
- Improved OCR Stability: Specialized regex-based filtering to ignore punctuation-only bubbles, preventing API hangs on common "..." sequences.
- Robust Text Rendering: Implemented failsafe logic in the font-sizing engine to prevent infinite loops in extremely small speech bubbles.
- Maintenance Logic: Automated cleanup of media files to prevent storage bloat.
- Python 3.10+
- PyTorch (for YOLO and Manga-OCR)
- CUDA-compatible GPU (optional, but recommended for speed)
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/Django-Manga-Translator.git cd Django-Manga-Translator -
Create a virtual environment:
python -m venv env source env/Scripts/activate # On Windows: env\Scripts\activate
-
Install dependencies:
pip install -r mangaTranslator/requirements.txt
-
Model Setup:
- Place your YOLOv8 bubble detection model (
model.pt) in themangaTranslator/model/directory.
- Place your YOLOv8 bubble detection model (
-
Environment Setup:
- Copy the template file:
cp .env.template .env - Open
.envand add yourDJANGO_SECRET_KEY. - (Optional) Customize
SERVER_PORTorDJANGO_DEBUG.
- Copy the template file:
-
Run Migrations:
cd mangaTranslator python manage.py migrate -
Start the server:
python manage.py runserver
Note: The server will log its start-up port and status to the daily log file.
- Open your browser and navigate to
http://127.0.0.1:8000/. - Enter the URL of the manga chapter you want to translate.
- Select your preferred font and translator.
- Click Translate and wait for the magic to happen!
mangaTranslator/: Main Django project directory.translate/: Main application logic (views, forms, scrapers).utils/: Helper modules for OCR, detection, and translation.media/: Storage for processed images.logs/: Application logs (created automatically).
While this fork introduces major reliability and UI improvements, there are several known limitations where the engine can still be improved:
- Bubble Detection Bias: The current YOLO model is primarily optimized for standard white bubbles.
- Common "Misses":
- Black/Dark Bubbles: Text in inverted bubbles may be missed or poorly OCR'ed.
- Stylized/Textured Bubbles: Bubbles with complex patterns or rough edges are harder to detect.
- Borderless Dialogue: Floating text without a clearly defined border is often skipped.
- Narration Boxes: Rectangular narration panels aren't always recognized as bubbles.
- Pipeline Constraints:
- No Fallback for Non-Bubble Text: The system does not currently attempt to find "free-floating" text outside of detected bubbles.
- OCR Dependency: OCR only runs on successfully detected areas; if the YOLO model misses a bubble, the text within it is missed entirely.
- Support for black/dark bubble inversion and Stylized/Textured Bubbles before OCR.
- Integration of a secondary text-only detector (like DBNet) for borderless text.
- Support for Manhwa (Korean) and Manhua (Chinese) layouts.
- Moving to a background task queue (Celery) for multi-page chapters.
- Original project by georgescutelnicu.
- Manga-OCR by kha-white.
- Ultralytics for the YOLOv8 implementation.