Skip to content

Repository files navigation

Scan Generator

A Flutter application that automatically processes and translates Korean webtoon/manga content by extracting images from web pages, performing OCR text recognition, and translating the text using AI services.

🎯 Project Goal

The Scan Generator is designed to automate the process of translating Korean webtoons and manga by:

  1. Web Scraping: Extracting image URLs from Korean webtoon platforms (Naver, Toomics)
  2. Image Processing: Downloading and processing comic page images
  3. Text Recognition: Using Google ML Kit to detect and extract Korean text from speech bubbles
  4. AI Translation: Translating Korean text to English using ChatGPT and DeepL APIs
  5. Image Reconstruction: Replacing original Korean text with English translations while maintaining visual quality
  6. Batch Processing: Automatically handling multiple pages and chapters

✨ Key Features

🔍 Smart Image Processing

  • Automatic Image Detection: Finds and downloads images from supported webtoon platforms
  • Split Bubble Detection: Intelligently detects and handles split speech bubbles across page boundaries
  • Image Optimization: Converts and optimizes images for processing

📝 Advanced Text Recognition

  • Korean OCR: Uses Google ML Kit for accurate Korean text recognition
  • Speech Bubble Detection: Automatically identifies and processes text within speech bubbles
  • Text Merging: Intelligently combines split text blocks for better translation context

🤖 AI-Powered Translation

  • Dual Translation Services:
    • ChatGPT: Context-aware translations with conversation understanding
    • DeepL: High-quality direct translations as fallback
  • Context Preservation: Maintains story context across multiple pages
  • Smart Caching: Caches translations to avoid redundant API calls

🎨 Visual Text Replacement

  • Bubble Recreation: Automatically creates new speech bubbles for translated text
  • Font Management: Supports multiple custom fonts for different text styles
  • Layout Preservation: Maintains original comic layout and visual flow

🔄 Automated Workflow

  • Ticket-Based Processing: Queue-based system for handling multiple translation jobs
  • Batch Operations: Processes multiple pages efficiently
  • Progress Tracking: Real-time progress monitoring and logging

🏗️ Architecture

Core Services

  • ImageService: Handles image processing, OCR, and translation
  • ScanService: Manages translation tickets and batch processing
  • HttpService: Handles API communications and file downloads
  • CacheService: Manages translation caching and file storage

Supported Platforms

  • Naver Webtoon: image-comic.pstatic.net
  • Toomics: toon.toomics.com

Translation APIs

  • OpenAI ChatGPT: Primary translation service with context awareness
  • DeepL API: Secondary translation service for direct translations

🚀 Getting Started

Prerequisites

  • Flutter SDK (>=2.18.4)
  • Android Studio / Xcode for mobile development
  • API keys for ChatGPT and DeepL services

Installation

  1. Clone the repository
  2. Install dependencies:
    flutter pub get
  3. Configure API keys in the service files
  4. Run the application:
    flutter run

Configuration

Update the following with your API keys:

  • ChatGPT API Key: In ImageService._translateWithChatGpt()
  • DeepL API Key: In ImageService._translateWithDeepL()

📱 Supported Platforms

  • Android: Full functionality with native performance
  • iOS: Full functionality with native performance
  • Web: Limited functionality (webview restrictions)
  • Desktop: Windows, macOS, Linux support

🔧 Technical Stack

Flutter Packages

  • google_ml_kit: Text recognition and OCR
  • flutter_inappwebview: Web content rendering
  • image: Image processing and manipulation
  • http: API communications
  • flutter_bloc: State management
  • path_provider: File system access
  • flutter_cache_manager: Caching system

External Services

  • Google ML Kit: Korean text recognition
  • OpenAI API: Context-aware translation
  • DeepL API: High-quality translation
  • Custom Backend: Ticket management and batch processing

📊 Workflow

  1. Ticket Retrieval: App requests a new translation job from backend
  2. Web Scraping: Loads the target webtoon page in webview
  3. Image Extraction: Finds and downloads all comic images
  4. Image Processing: Splits pages if needed and optimizes for OCR
  5. Text Recognition: Extracts Korean text from speech bubbles
  6. Translation: Translates text using AI services with context
  7. Image Reconstruction: Replaces Korean text with English translations
  8. Upload: Sends processed images back to backend
  9. Repeat: Continues with next ticket

🎨 Customization

Fonts

The app supports multiple custom fonts located in the assets/ directory:

  • Augie
  • Another Danger
  • BD Cartoon
  • CC Astro City
  • Zud Juice

Translation Rules

Customize translation behavior by modifying the ChatGPT prompt in ImageService._translateWithChatGpt().

⚠️ Important Notes

  • API Rate Limits: Be mindful of API usage limits for translation services
  • Copyright: Ensure you have rights to translate and process the content
  • Performance: Large batches may take significant time to process
  • Network: Requires stable internet connection for API calls

🔒 Security

  • API keys are currently hardcoded (consider using environment variables for production)
  • All processing is done locally except for translation API calls
  • No user data is stored permanently

📈 Future Enhancements

  • Support for additional webtoon platforms
  • More language pairs for translation
  • Improved text bubble detection algorithms
  • Batch processing optimization
  • User interface improvements
  • Translation quality feedback system

🤝 Contributing

This appears to be a personal project for automated webtoon translation. If you're interested in contributing or have suggestions, please feel free to reach out.

📄 License

This project is for personal use. Please respect copyright laws and terms of service of the platforms you're processing content from.

About

Translate korean webtoon automatically, using basic AI tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages