Home

Awesome

Comic Translate

English | 한국어 | Français | 简体中文 | 日本語 | Português Brasileiro

<img src="https://i.imgur.com/aNuwiJb.png">

Intro

Many Automatic Manga Translators exist. Very few properly support comics of other kinds in other languages. This project was created to utilize the ability of State of the Art (SOTA) Large Language Models (LLMs) like GPT-4 and translate comics from all over the world. Currently, it supports translating to and from English, Korean, Japanese, French, Simplified Chinese, Traditional Chinese, Russian, German, Dutch, Spanish and Italian. It can translate to (but not from) Turkish, Polish, Portuguese and Brazillian Portuguese.

The State of Machine Translation

For a couple dozen languages, the best Machine Translator is not Google Translate, Papago or even DeepL, but a SOTA LLM like GPT-4o, and by far. This is very apparent for distant language pairs (Korean<->English, Japanese<->English etc) where other translators still often devolve into gibberish. Excerpt from "The Walking Practice"(보행 연습) by Dolki Min(돌기민) Model

Comic Samples

GPT-4 as Translator. Note: Some of these also have Official English Translations

The Wretched of the High Seas

<img src="https://i.imgur.com/75HwK4r.jpg" width="49%"> <img src="https://i.imgur.com/3oRt5fX.jpg" width="49%">

Journey to the West

<img src="https://i.imgur.com/zk7yiKe.jpg" width="49%"> <img src="https://i.imgur.com/4ycSi8j.jpg" width="49%">

The Wormworld Saga

<img src="https://i.imgur.com/cVVGVXp.jpg" width="49%"> <img src="https://i.imgur.com/SSl81sb.jpg" width="49%">

Frieren: Beyond Journey's End

<img src="https://i.imgur.com/ANGHVhG.png" width="49%"> <img src="https://i.imgur.com/r5YOE26.png" width="49%">

Days of Sand

<img src="https://i.imgur.com/m7PDiXN.jpg" width="49%"> <img src="https://i.imgur.com/eUwTGnn.jpg" width="49%">

Player (OH Hyeon-Jun)

<img src="https://i.imgur.com/KGwiHJh.jpg" width="49%"> <img src="https://i.imgur.com/B8RMbRQ.jpg" width="49%">

Carbon & Silicon

<img src="https://i.imgur.com/h51XJx4.jpg" width="49%"> <img src="https://i.imgur.com/sLitjUY.jpg" width="49%">

Installation

Python

Install Python (>=3.10). Tick "Add python.exe to PATH" during the setup.

https://www.python.org/downloads/

Clone the repo (or download the folder), navigate to the folder

git clone https://github.com/ogkalu2/comic-translate
cd comic-translate

and install the requirements

pip install -r requirements.txt

If you run into any issues, you can try running it in a virtual environment. Open the terminal/cmd in whatever directory you want the virtual environment installed (or cd 'path/to/virtual environment/folder'). Create your virtual environment with:

python -m venv comic-translate-venv

Now activate the virtual environment. On Windows:

comic-translate-venv\Scripts\activate

On Mac and Linux:

source comic-translate-venv/bin/activate

Now you can run the Installation Commands again. When you are finished using the app, you can deactivate the virtul environment with:

deactivate

To re-activate, use the same commands with the terminal in the folder your virtual environment folder is located in.

If you have an NVIDIA GPU, then it is recommended to run

pip uninstall torch torchvision
pip install torch==2.1.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchvision==0.16.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html

Note: The 121 in +cu121 represents the CUDA version - 12.1. Replace 121 with your CUDA version. E.g 118 if you are running CUDA 11.8

Usage

In the comic-translate directory, run

python comic.py

This will launch the GUI

Tips

raise RarCannotExec("Cannot find working tool")

In that case, Instructions for Windows, Linux, Mac

API Keys

To following selections will require access to closed resources and subsequently, API Keys:

Getting API Keys

Open AI (GPT)

Google Cloud Vision

How it works

Speech Bubble Detection and Text Segmentation

speech-bubble-detector, text-segmenter. Two yolov8m models trained on 8k and 3k images of comics (Manga, Webtoons, Western) respectively.

<img src="https://i.imgur.com/TlzVH3j.jpg" width="49%"> <img src="https://i.imgur.com/h18XrYT.jpg" width="49%">

OCR

By Default:

Optional:

These can be used for any of the supported languages. An API Key is required.

Inpainting

A Manga/Anime finetuned lama checkpoint to remove text detected by the segmenter. Implementation courtsey of lama-cleaner

<img src="https://i.imgur.com/cVVGVXp.jpg" width="49%"> <img src="https://i.imgur.com/bLkPyqG.jpg" width="49%">

Translation

Currently, this supports using GPT-4o, GPT-4o mini, DeepL, Claude-3-Opus, Claude-3.5-Sonnet, Claude-3-Haiku, Gemini-1.5-Flash, Gemini-1.5-Pro, Yandex, Google Translate and Microsoft Translator.

All LLMs are fed the entire page text to aid translations. There is also the Option to provide the Image itself for further context.

Text Rendering

PIL for rendering wrapped text in bounding boxes obtained from bubbles and text.

Acknowledgements