跳到正文
GitHub·· 8 小时前AI 评分58

MangaTranslator 开源一键漫画翻译工具

meangrinch/MangaTranslator

AI 导读

MangaTranslator 是一个开源一键漫画翻译应用,可处理漫画、韩漫、国漫和连环画,支持 60 多种语言。它用 YOLO 与 SAM 2.1/3 检测对话气泡和气泡外文字,用 FLUX.1 Kontext、FLUX.2 Klein 或 OpenCV 擦除并修复背景,再通过云端 API 或本地 LLM 翻译并自定义字体排版。

正文

English | 简体中文 | 한국어 | 日本語

One-click app that translates manga, manhwa, manhua, and comics using ML models. Targets both speech bubbles and outside-bubble text, restores background art with diffusion-based inpainting, and typesets translations across 60+ languages using LLMs and custom fonts.

Original Translated (One-Click)
Original → Translated (One-Click)


Quick Setup

1. Download

  • Portable Package (Recommended): Download the portable build from Releases.
    • Windows: No requirements.
    • Linux / macOS: Requires Python 3.10+ and Git.
  • From Source:
    git clone https://github.com/meangrinch/MangaTranslator.git
    cd MangaTranslator
    python -m venv venv
    .\venv\Scripts\activate # or source venv/bin/activate (Linux/macOS)
    pip install torch==2.11.0+cu130 torchvision==0.26.0+cu130 --extra-index-url https://download.pytorch.org/whl/cu130 # or pip install torch==2.11.0 torchvision==0.26.0 (macOS)
    pip install -r requirements.txt

For additional information, see Installation.

2. Configure

  • Provider: In the Web UI, navigate to Config → Translation to select your LLM provider (e.g., Google, OpenAI, Anthropic, DeepSeek...) and enter your API key, or use a local OpenAI-compatible endpoint (e.g., llama.cpp). Save to config to persist API keys/settings across sessions.
  • Outside-Bubble Text (Optional): Navigate to Config → OSB Text and set a Hugging Face token with access to deepghs/AnimeText_yolo.
  • Environment Variables: Alternatively, you can configure credentials in your environment (e.g., GEMINI_API_KEY, HF_TOKEN) for both Web UI and CLI usage.

For additional information, see Configuration.

3. Translate

  • Web UI: Upload images to the Translator/Batch tab and click Translate.
  • CLI:
    python main.py --input "path/to/page.jpg" --input-language "Japanese" --output-language "English" --font-dir "fonts/Komika Hand" --provider Google --google-api-key <...> --osb-enable --osb-font-dir "fonts/Comicka" --osb-hf-token <...>

For additional examples, see CLI.

Tip

You can enable Cleaning-only Mode by navigating to Config → Other in the Web UI, or pass --cleaning-only in the CLI, to remove text without translating (e.g., for manual scanlation).


Features

  • Automation: One-click translation; no manual intervention required
  • Interfaces: Web UI (Gradio) and CLI
  • Processing: Single image, folder, and ZIP/CBZ archive batch processing (with directory preservation)
  • Detection: Speech bubble and outside-bubble text detection (YOLO, SAM 2.1/3)
  • Cleaning: Inpaint speech bubbles and background text (FLUX.2 Klein, FLUX.1 Kontext, or OpenCV)
  • Translation: OCR and translation supporting 60+ languages (cloud API or local LLM)
  • Rendering: Custom text rendering with alignment, word wrap, and custom font packs
  • Upscaling: Text region and full-page artwork upscaling (2x-AnimeSharpV4)
  • Configuration: Flexible controls to adapt to diverse page layouts and fine-tune output quality

Documentation


Support the Project

MangaTranslator is open-source and free. If it saves you time or enhances your reading experience, consider supporting its development!

Support on Ko-fi


License & Credits

ML Models and Libraries

来源:GitHub · github.com