How zyddnys/manga-image-translator works
High-Level Architecture Components
The system should be divided into these main components:
a) Input/Output Layer
• Input handlers for images and configuration
• Output handlers for translated images and formats (XCF, PSD, PDF)
• Web server interface for API access
b) Core Processing Pipeline
• Detection Module (text detection in images)
• OCR Module (text recognition)
• Translation Module (multiple translation services)
• Inpainting Module (background restoration)
• Rendering Module (text rendering)
c) Support Systems
• Model Management
• Configuration Management
• Threading/Processing Control
Detailed Component Breakdown
a) Detection Module:
• Multiple detector implementations (default, dbconvnext, ctd, craft)
• Panel detection subsystem
• Text region detection and processing
• Mask generation pipeline
b) OCR Module:
• Multiple OCR models (32px, 48px, 48px_ctc, mocr)
• Text preprocessing
• Language detection
• Text merging system
c) Translation Module:
• Online translators (GPT, DeepL, Google, etc.)
• Offline translators (NLLB, M2M100, etc.)
• Translation chain management
• Dictionary support (pre/post processing)
d) Inpainting Module:
• Multiple inpainting models (lama, SD, etc.)
• Mask refinement system
• Background reconstruction
e) Rendering Module:
• Text layout engine
• Font management
• Direction handling (vertical/horizontal)
• GIMP integration for advanced formats
Data Flow Representation
Flow of data through the system:
Input Image → Detection → OCR → Translation → Inpainting → Rendering → Output
• ↓ ↓ ↓ ↓ ↓
• Masks → Text Regions → Text → Clean Image → Final Image
Integration Points
Following integration points:
• Model loading and management system
• Configuration injection points
• API endpoints for web service
• External service connections (translation APIs)
• File system interaction points
Implementation Details
Technical details such as:
• Python as the primary language
• PyTorch for deep learning models
• Docker containerization support
• Web API using FastAPI
• File format support (XCF, PSD, PDF)
• GPU acceleration capabilities