# Waifu2x Python
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://badge.fury.io/py/waifu2x-python)
Python wrapper for waifu2x-ncnn-vulkan with a simple and powerful interface for image and video frame upscaling.
## Features
- High-performance image upscaling using waifu2x-ncnn-vulkan
- Support for multiple image formats (PNG, JPG, WEBP, etc.)
- Multiple models including anime and photo styles
- GPU acceleration with fallback to CPU
- Batch processing of multiple images
- Progress tracking and error handling
## Installation
```bash
pip install waifu2x-python
```
### Dependencies
- waifu2x-ncnn-vulkan
- Python 3.8+
- OpenCV
- NumPy
- Pillow
## Usage
### Basic Example
```python
from waifu2x_python import Waifu2x, ProcessingConfig
# Initialize with default settings
waifu2x = Waifu2x()
# Process a single image
result = waifu2x.process("input.jpg", "output_2x.jpg")
print(f"Processed image saved to: {result.output_path}")
```
### Advanced Configuration
```python
from waifu2x_python import Waifu2x, ProcessingConfig, ModelType
# Custom configuration
config = ProcessingConfig(
model=ModelType.UPCONV_7_ANIME, # or ModelType.CUNET, ModelType.UP_PHOTO, etc.
scale=2, # 1, 2, 4, 8, 16, 32
noise=1, # -1 to 3 (-1 = no effect, 0 = no noise reduction, 1-3 = noise reduction level)
gpu_id=0, # -1 for CPU-only, 0 for first GPU, 1 for second GPU, etc.
tile_size=0, # 0 for auto
num_threads=4 # Number of CPU threads to use
)
waifu2x = Waifu2x(config=config)
# Process all images in a folder
results = waifu2x.process_folder("input_folder", "output_folder")
print(f"Processed {len([r for r in results if r.success])}/{len(results)} images successfully")
```
### Command Line Interface
```bash
# Basic usage
waifu2x -i input.jpg -o output.png
# Process folder recursively
waifu2x -i input_folder -o output_folder -r
# Custom settings
waifu2x -i input.jpg -o output.png -m models-upconv_7_anime_style_art_rgb -s 2 -n 1 -g 0 -t 200
# CPU-only mode
waifu2x -i input.jpg -o output.png -g -1
```
## Available Models
- `models-cunet` - High quality denoising and upscaling (default)
- `models-upconv_7_anime_style_art_rgb` - For anime-style art
- `models-upconv_7_photo` - For photos
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgements
- [waifu2x-ncnn-vulkan](https://github.com/nihui/waifu2x-ncnn-vulkan) - The underlying engine
- [ncnn](https://github.com/Tencent/ncnn) - High-performance neural network inference framework
- [Vulkan](https://www.vulkan.org/) - Cross-platform 3D graphics and compute API
Raw data
{
"_id": null,
"home_page": "https://github.com/gleidsonnunes/waifu2x-python",
"name": "waifu2x-python",
"maintainer": "Gleidson Rodrigues Nunes",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Gleidson Rodrigues Nunes <gleidsonrnunes@gmail.com>",
"keywords": "waifu2x, super-resolution, image-processing, computer-vision, deep-learning, ncnn, vulkan, upscaling, denoising",
"author": "AI Assistant",
"author_email": "Gleidson Rodrigues Nunes <gleidsonrnunes@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/61/16/cc1fce0e724449418a27b2c95a438024e1a6d7c2effaea469bc6f17bdf4c/waifu2x_python-2.0.4.tar.gz",
"platform": "any",
"description": "# Waifu2x Python\r\n\r\n[](https://www.python.org/downloads/)\r\n[](https://opensource.org/licenses/MIT)\r\n[](https://badge.fury.io/py/waifu2x-python)\r\n\r\nPython wrapper for waifu2x-ncnn-vulkan with a simple and powerful interface for image and video frame upscaling.\r\n\r\n## Features\r\n\r\n- High-performance image upscaling using waifu2x-ncnn-vulkan\r\n- Support for multiple image formats (PNG, JPG, WEBP, etc.)\r\n- Multiple models including anime and photo styles\r\n- GPU acceleration with fallback to CPU\r\n- Batch processing of multiple images\r\n- Progress tracking and error handling\r\n\r\n## Installation\r\n\r\n```bash\r\npip install waifu2x-python\r\n```\r\n\r\n### Dependencies\r\n\r\n- waifu2x-ncnn-vulkan\r\n- Python 3.8+\r\n- OpenCV\r\n- NumPy\r\n- Pillow\r\n\r\n## Usage\r\n\r\n### Basic Example\r\n\r\n```python\r\nfrom waifu2x_python import Waifu2x, ProcessingConfig\r\n\r\n# Initialize with default settings\r\nwaifu2x = Waifu2x()\r\n\r\n# Process a single image\r\nresult = waifu2x.process(\"input.jpg\", \"output_2x.jpg\")\r\nprint(f\"Processed image saved to: {result.output_path}\")\r\n```\r\n\r\n### Advanced Configuration\r\n\r\n```python\r\nfrom waifu2x_python import Waifu2x, ProcessingConfig, ModelType\r\n\r\n# Custom configuration\r\nconfig = ProcessingConfig(\r\n model=ModelType.UPCONV_7_ANIME, # or ModelType.CUNET, ModelType.UP_PHOTO, etc.\r\n scale=2, # 1, 2, 4, 8, 16, 32\r\n noise=1, # -1 to 3 (-1 = no effect, 0 = no noise reduction, 1-3 = noise reduction level)\r\n gpu_id=0, # -1 for CPU-only, 0 for first GPU, 1 for second GPU, etc.\r\n tile_size=0, # 0 for auto\r\n num_threads=4 # Number of CPU threads to use\r\n)\r\n\r\nwaifu2x = Waifu2x(config=config)\r\n\r\n# Process all images in a folder\r\nresults = waifu2x.process_folder(\"input_folder\", \"output_folder\")\r\nprint(f\"Processed {len([r for r in results if r.success])}/{len(results)} images successfully\")\r\n```\r\n\r\n### Command Line Interface\r\n\r\n```bash\r\n# Basic usage\r\nwaifu2x -i input.jpg -o output.png\r\n\r\n# Process folder recursively\r\nwaifu2x -i input_folder -o output_folder -r\r\n\r\n# Custom settings\r\nwaifu2x -i input.jpg -o output.png -m models-upconv_7_anime_style_art_rgb -s 2 -n 1 -g 0 -t 200\r\n\r\n# CPU-only mode\r\nwaifu2x -i input.jpg -o output.png -g -1\r\n```\r\n\r\n## Available Models\r\n\r\n- `models-cunet` - High quality denoising and upscaling (default)\r\n- `models-upconv_7_anime_style_art_rgb` - For anime-style art\r\n- `models-upconv_7_photo` - For photos\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Acknowledgements\r\n\r\n- [waifu2x-ncnn-vulkan](https://github.com/nihui/waifu2x-ncnn-vulkan) - The underlying engine\r\n- [ncnn](https://github.com/Tencent/ncnn) - High-performance neural network inference framework\r\n- [Vulkan](https://www.vulkan.org/) - Cross-platform 3D graphics and compute API\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "High-performance Python wrapper for waifu2x-ncnn-vulkan with GPU/CPU support",
"version": "2.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/gleidsonnunes/waifu2x-python/issues",
"Changelog": "https://github.com/gleidsonnunes/waifu2x-python/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/gleidsonnunes/waifu2x-python#readme",
"Homepage": "https://github.com/gleidsonnunes/waifu2x-python",
"Repository": "https://github.com/gleidsonnunes/waifu2x-python.git"
},
"split_keywords": [
"waifu2x",
" super-resolution",
" image-processing",
" computer-vision",
" deep-learning",
" ncnn",
" vulkan",
" upscaling",
" denoising"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "da9451b06fc7223ab682ecc1579fde00f01f776fa03ccfc1fcb33f59f4a82fdf",
"md5": "f37930acbae258f58076e2cc98d40773",
"sha256": "90ae6db8dd190ce0dfe3fe9147f9eb24d6862d5a13969d6e98c53ba3ed55b4d0"
},
"downloads": -1,
"filename": "waifu2x_python-2.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f37930acbae258f58076e2cc98d40773",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21454,
"upload_time": "2025-08-23T23:11:37",
"upload_time_iso_8601": "2025-08-23T23:11:37.574865Z",
"url": "https://files.pythonhosted.org/packages/da/94/51b06fc7223ab682ecc1579fde00f01f776fa03ccfc1fcb33f59f4a82fdf/waifu2x_python-2.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6116cc1fce0e724449418a27b2c95a438024e1a6d7c2effaea469bc6f17bdf4c",
"md5": "007cc7cc3b64dcde8bdbfcf5d802044a",
"sha256": "0309f1e342c834fdec71ff47272af657ccefd5d30ff3ce444ded6772f706f25f"
},
"downloads": -1,
"filename": "waifu2x_python-2.0.4.tar.gz",
"has_sig": false,
"md5_digest": "007cc7cc3b64dcde8bdbfcf5d802044a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 22098,
"upload_time": "2025-08-23T23:11:38",
"upload_time_iso_8601": "2025-08-23T23:11:38.902835Z",
"url": "https://files.pythonhosted.org/packages/61/16/cc1fce0e724449418a27b2c95a438024e1a6d7c2effaea469bc6f17bdf4c/waifu2x_python-2.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-23 23:11:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gleidsonnunes",
"github_project": "waifu2x-python",
"github_not_found": true,
"lcname": "waifu2x-python"
}