Real-ESRGAN image upscaling#172
Open
lucasliet wants to merge 4 commits into
Open
Conversation
Major Feature: AI-powered image upscaling with Real-ESRGAN - Core ML backend for macOS with Neural Engine acceleration (2x/4x) - PyTorch backend for Linux/Windows with CUDA/CPU support (2x/4x) - NCNN backend for macOS (legacy Vulkan support) Security Enhancements: - SHA256 validation for all model downloads (Core ML, PyTorch, NCNN) - Automatic integrity checks before model loading/extraction - Fallback URL system for reliable Core ML model downloads - Protection against corrupted or malicious downloads Infrastructure: - Refactored GitHub Actions workflows for macOS arm64 builds - Added Claude Code integration workflow - Updated CI/CD pipeline with proper artifact handling Documentation: - Comprehensive CLAUDE.md for development guidance - Updated README with upscaling features and requirements - Detailed changelog with version history Technical Details: - Tile-based processing for large images (256x256 tiles) - Weighted blending with feathering for seamless upscaling - SHA256-based marker system to skip already upscaled images - Graceful shutdown handling with threading events Files Changed: 22 files (+1963/-282 lines) - New: upscale.py, upscale_coreml.py, upscale_ncnn.py, CLAUDE.md - Modified: CI workflows, README, requirements, format handlers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Standardizes the 4x upscaling model across all backends to `RealESRGAN_x4plus_anime_6B` and sets 4x as the new default scaling factor. This improves quality and consistency. - **Standardized 4x Upscaling Model**: Switched PyTorch backend from `realesr-general-x4v3.pth` to `RealESRGAN_x4plus_anime_6B.pth` for consistency with Core ML and NCNN backends. - **4x as Default**: Changed the default upscale factor from 2x to 4x for higher quality out-of-the-box. - **Enhanced Validation**: Added strict validation to only allow `2` or `4` as scale factors at the configuration level. - **Code Cleanup**: Removed legacy code paths for 3x upscaling and clarified model selection logic. - **Default upscale scale changed from 2x to 4x**: Users who relied on the 2x default will need to explicitly use `--upscale-scale 2`. - The old `realesr-general-x4v3.pth` model is no longer used and will be replaced by the new anime-specific model on first run. - Updated `README.md` and `CLAUDE.md` with the new default scale, model names, and usage examples. - Added a new entry to `docs/changelog.md` for version `v3.2.1-upscale`.
- Updated default upscale factor from 2x to 4x across all backends. - Removed legacy 3x support and added strict validation for upscale scale (2 or 4). - Introduced cleanup method for upscale markers after successful processing. - Updated documentation and changelog to reflect changes in upscaling features. - Refactored requirements to separate upscale-specific dependencies. - Removed NCNN backend implementation as it was no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Core ML and on Linux/Windows via PyTorch.
upscale extra is installed.
checks to skip already processed images. remove them after finish vol/chapter upscaling
Implementation Notes
RealESRGAN_x4plus_anime_6B.pth).
RealESRGAN_x4plus_anime_6B.mlpackage). (conversion made with Aidoku upscale script https://github.com/Aidoku/upscale?tab=readme-ov-file)
cleanup queue.
etc.) and restrict them to Python 3.10–3.12 (not compatible with 3.13 at moment, therefore I decided to made a exclusive scope for them named "upscale"), keeping the core package compatible with 3.10+.
Known Caveat
or for PyInstaller builds produced by CI, write permissions may be limited. If that becomes an issue we
may need to redirect the cache to a writable user directory (e.g. ~/.cache/mangadex-downloader).
Testing
Screenshots
Download and upscale 
Resume upscale and download

Default run without upscale with warning because of flag usage

Default run without flag, and no warnings

there are some errors connecting to "https://api.mangadex.network/report" but that happens to me on main version too
Upscale Result
Before:
After:

Sources: https://github.com/xinntao/Real-ESRGAN https://github.com/Aidoku/Aidoku