A powerful tool for evaluating texture quality loss during scaling. Essentially, it analyzes images by reducing their resolution and then increasing them back to the original size, after which it measures the difference between the original and processed images using various perceptual metrics.
- Comprehensive Analysis: Analyze image quality at various resolutions using multiple metrics
- Multiple Metrics: PSNR, SSIM, MS-SSIM, TDPR, and LPIPS support
- Optimal Resolution Suggestion: Get recommendations for the best resolution based on quality thresholds
- Interpolation Methods: Choose between Bilinear, Bicubic, and Mitchell-Netravali interpolations
- Per-Channel Analysis: Examine quality metrics for individual RGB/RGBA channels
- Visualization: Generate charts showing quality vs. resolution
- ML-Powered: Fast quality estimation using machine learning models
- Export Options: Save results to CSV and JSON formats
- Multilingual: Supports English and Russian interfaces
- Python 3.10+
- NumPy, OpenCV, Pillow for image processing
- PyTorch (optional, for GPU acceleration and LPIPS)
- Matplotlib for visualization
- Scikit-learn for ML features
git clone https://github.com/RomanVPX/ResolutionSuggester.git
cd ResolutionSuggester
pip install .
For development installation:
pip install -e ".[dev]"
ResolutionSuggester provides two command-line interfaces and two subcommands:
resolution_suggester {analyze, model} [options] PATHS
- main commandres-suggest {analyze, model} [options] PATHS
- shorthand alias
Interface language could be chosen if not detected automatically:
res-suggest analyze {analyze, model} --lang en [options] PATHS
- force English as an interface languageres-suggest analyze {analyze, model} --lang ru [options] PATHS
- force Russian as an interface language
# Show help on [analyze] subcommand
res-suggest analyze --help
# Show help on [model] subcommand
res-suggest model --help
res-suggest analyze /path/to/image.png
res-suggest analyze /path/to/textures/folder/
# Choose from: psnr, ssim, ms_ssim, tdpr, lpips
res-suggest analyze image.png -m ssim
# Choose from: alex (default/balanced), vgg (memory-hungry), squeeze (fast)
res-suggest analyze image.png -m lpips --lpips-net vgg
# Choose from: bilinear, bicubic, mitchell (default)
res-suggest analyze image.png -i bilinear
res-suggest analyze image.png -c
res-suggest analyze image.png --chart
# Choose from: dark (default), light
res-suggest analyze image.png --chart --theme light
res-suggest analyze image.png -o # .csv
res-suggest analyze image.png -j # .json
res-suggest analyze image.png --ml
# Default and minimum is 16
res-suggest analyze image.png --min-size 32
# Disable parallel processing
res-suggest analyze image.png --no-parallel
# Set specific number of threads
res-suggest analyze image.png -t 4
# Save downscaled images
res-suggest analyze image.png --save-im-down
# Save upscaled images after downscaling
res-suggest analyze image.png --save-im-up
# Save all generated images
res-suggest analyze image.png -s
# Choose from: en, ru, auto (default)
res-suggest analyze image.png --lang ru
╭───── Analysis (MS_SSIM) ─────╮
│ LevelLight-01_comp_light.exr │
╰──────────────────────────────╯
┏━━━━━━━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Resolution ┃ R ┃ G ┃ B ┃ A ┃ Min ┃ Quality ┃ Quality Bar ┃
┡━━━━━━━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ 1024x1024 │ 1.00 │ 1.00 │ 1.00 │ 1.00 │ 1.00 │ Original │ │
│ 512x512 │ 1.00 │ 1.00 │ 1.00 │ 0.99 │ 0.99 │ Excellent │ ██████████████░ │
│ 256x256 │ 0.97 │ 0.98 │ 0.97 │ 0.96 │ 0.96 │ Very good │ ██████████████░ │
│ 128x128 │ 0.91 │ 0.93 │ 0.90 │ 0.87 │ 0.87 │ Noticeable loss │ █████████████░░ │
│ 64x64 │ 0.82 │ 0.86 │ 0.80 │ 0.76 │ 0.76 │ Noticeable loss │ ███████████░░░░ │
│ 32x32 │ 0.75 │ 0.80 │ 0.71 │ 0.64 │ 0.64 │ Noticeable loss │ █████████░░░░░░ │
│ 16x16 │ 0.73 │ 0.78 │ 0.67 │ 0.59 │ 0.59 │ Noticeable loss │ ████████░░░░░░░ │
└────────────┴──────┴──────┴──────┴──────┴──────┴─────────────────┴─────────────────┘
# Genarate dataset
res-suggest model --generate-dataset /path/to/training/images/
# Train ML model using generated dataset
res-suggest model --train-ml /path/to/training/images/
# Generate dataset and train ML model in one go
res-suggest model --generate-dataset --train-ml /path/to/training/images/
res-suggest analyze image.png --compare-ml
# Disable GPU acceleration during analysis
res-suggest analyze image.png --no-gpu
# Disable GPU acceleration during dataset generation
res-suggest model --generate-dataset --no-gpu /path/to/training/images/
- EXR (.exr)
- TGA (.tga)
- PNG (.png)
- JPEG (.jpg, .jpeg)
Contributions are welcome! Please check out our Contributing Guide.
This project is licensed under the MIT License - see the LICENSE file for details.
- Roman Vishnyakov - Initial work - RomanVPX