Quantitative analysis toolkit for JPEG XL (JXL) compression quality. Compare JXL 16-bit, JXL 8-bit and JPEG 8-bit with detailed SNR (Signal-to-Noise Ratio) metrics.
- JXL vs JPEG Comparison - Compare JXL 16-bit, JXL 8-bit and JPEG 8-bit side-by-side
- Batch Processing - Analyze multiple images and get averaged results
- Full Metrics Table - All SNR ranges: >50dB, >40dB, >30dB, >20dB, 40-50dB, 30-40dB, 20-30dB, <20dB
- Export to CSV/JSON - Easy data analysis in Excel or Python
| Script | Purpose | Use Case |
|---|---|---|
main.py |
Single TIFF analysis | Quick test of one image, multiple distances |
compare_light.py |
JXL vs JPEG comparison | Batch compare formats across multiple images |
git clone https://github.com/rsilvabr/jxl-quality-analyzer.git
cd jxl-quality-analyzer
pip install -r requirements.txtEdit compare_light.py and set your TIFF folder:
TIFF_FOLDER = "E:/TIFF16" # <-- Change this
NUM_IMAGES = 10 # <-- How many images to testRun:
python compare_light.pyResults saved to JXL_JPG_TESTS/comparison_results_YYYYMMDD_HHMMSS.csv
# Folder with 16-bit TIFF files
TIFF_FOLDER = "E:/TIFF16"
# Number of images to process (set to 1 for quick test)
NUM_IMAGES = 10
# Parallel workers (adjust based on your RAM!)
# - 4 workers = ~8GB RAM usage
# - 8 workers = ~16-20GB RAM usage
# - 16 workers = ~32-40GB RAM usage
PARALLEL_WORKERS = 8
# JXL distances to test
JXL_DISTANCES = [0.01, 0.02, 0.05, 0.1, 0.15, 0.2, 0.3, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0]
# JPEG qualities to test
JPEG_QUALITIES = [100, 99, 95, 90, 85, 80, 70, 60, 50, 40, 30, 20, 10]
# JXL effort level (7 = good balance, 9 = smaller files, slower)
JXL_EFFORT = 7--- JXL 16-bit ---
d | MB | SNR | <20dB | 20-30 | 30-40 | 40-50 | >50dB | >40dB | >30dB | >20dB
------------------------------------------------------------------------------------------------------------
0.01 | 73.99 | 71.8 | 0.000000% | 0.00% | 0.01% | 0.43% | 99.56% | 99.99% | 100.00% | 100.00%
0.10 | 27.45 | 57.5 | 0.000007% | 0.02% | 1.07% | 7.76% | 91.14% | 98.91% | 99.98% | 100.00%
1.00 | 5.20 | 47.2 | 0.003984% | 0.63% | 10.04% | 34.44% | 54.88% | 89.32% | 99.36% | 100.00%
--- JPEG 8-bit ---
Q | MB | SNR | <20dB | 20-30 | 30-40 | 40-50 | >50dB | >40dB | >30dB | >20dB
------------------------------------------------------------------------------------------------------------
100 | 37.30 | 52.4 | 0.000000% | 0.00% | 0.47% | 29.41% | 70.12% | 99.53% | 100.00% | 100.00%
95 | 12.50 | 47.7 | 0.000000% | 0.07% | 7.68% | 41.71% | 50.54% | 92.25% | 99.93% | 100.00%
90 | 8.01 | 45.8 | 0.000090% | 0.41% | 12.93% | 41.95% | 44.71% | 86.66% | 99.59% | 100.00%
| Metric | Description |
|---|---|
| SNR mean (dB) | Average signal-to-noise ratio across all pixels |
| >50dB % | Perceptually lossless pixels |
| >40dB % | Excellent quality pixels |
| >30dB % | Very good quality pixels |
| >20dB % | Acceptable quality pixels |
| 40-50dB % | Excellent but not lossless |
| 30-40dB % | Very good quality |
| 20-30dB % | Acceptable quality |
| <20dB % | Visible artifacts (avoid) |
| SNR | Quality | Recommended Use |
|---|---|---|
| >50dB | Perceptually lossless | Master archiving |
| 40-50dB | Excellent | Professional use |
| 30-40dB | Very good | General use |
| 20-30dB | Acceptable | Web/delivery |
| <20dB | Visible artifacts | Avoid for photos |
Python 3.8+
libjxl (cjxl, djxl) https://github.com/libjxl/libjxl
ImageMagick 7 https://imagemagick.org
8GB RAM (for 1-2 images)
16GB+ RAM (for 5-10 images)
SSD with 50GB+ free space (temp files)
Modern multi-core CPU (Ryzen 5 / Intel i5+)
Ryzen 9 5950X + 64GB RAM:
- 10 images (45MP each), 8 workers: ~47 minutes
- RAM usage: peaks at 80% (with pagefile on NVMe SSD)
- CPU usage: 80%+ sustained load
cjxl --version # libjxl encoder
djxl --version # libjxl decoder
magick --version # ImageMagick
python -c "import numpy; import tifffile" # Python libsjxl-quality-analyzer/
|
|-- README.md <- You are here
|-- compare_light.py <- JXL vs JPEG comparison (NEW!)
|-- main.py <- Single image analysis
|-- config.py <- Config for main.py
|-- jxl_processor.py <- JXL compress/decompress
|-- utils.py <- SNR metrics calculation
|-- visualization.py <- Charts and tables
|-- requirements.txt <- Python dependencies
|-- .gitignore <- Ignores JXL_JPG_TESTS/
|
|-- JXL_JPG_TESTS/ <- Results and temp files (auto-created)
| |-- comparison_results_*.csv <- Aggregated results
| |-- comparison_raw_*.json <- Per-image raw data
- Start Small: Test with
NUM_IMAGES = 1first - Adjust Workers: If RAM is limited, reduce
PARALLEL_WORKERSto 4 - SSD Recommended: Temp files can use 20-50GB during processing
- Close Other Apps: Free up RAM before running batch analysis
MIT License
These tools were made for my personal workflow. Use at your own risk — I am not responsible for any issues you may encounter.
However, if you find any bugs, feel free to report to me - I will gladly try my best to improve this project.
Warning: Batch processing is resource-intensive. Even on high-end hardware (Ryzen 5950X + 64GB RAM), expect sustained high CPU/RAM usage.