Add distance slider for JPEG XL.
Feature Description
One of three ways to implement this.
- Add an option to replace quality slider in advanced settings
- Replace and make quality slider optional instead. (Preferred)
- Remove quality slider entirely in favor of distance slider.
Technical Details
Distance is very useful for quickly encoding image with expectations more tilted towards quality than the size or when choosing quality between 0-100 is difficult.
Existing Implementations
JPEG XL's encoder itself.
Quality in cjxl is internally mapped to distance. Using one or the other results in an identical file. Quality is just a commonly understood abstraction.
This is the libjxl implementation:
float JxlEncoderDistanceFromQuality(float quality) {
return quality >= 100.0 ? 0.0
: quality >= 30
? 0.1 + (100 - quality) * 0.09
: 53.0 / 3000.0 * quality * quality - 23.0 / 20.0 * quality + 25.0;
}
Corresponding values:
| Quality | Distance |
|---|---|
| 100 | 0.0 |
| 90 | 1.0 |
| 80 | 1.9 |
| 70 | 2.8 |
| 60 | 3.7 |
| 50 | 4.6 |
| 40 | 5.5 |
| 30 | 6.4 |
| 20 | 9.0(6) |
| 10 | 15.2(6) |
| 0 | 25.0 |
Quality in
cjxlis internally mapped to distance. Using one or the other results in an identical file. Quality is just a commonly understood abstraction.This is the
libjxlimplementation:float JxlEncoderDistanceFromQuality(float quality) { return quality >= 100.0 ? 0.0 : quality >= 30 ? 0.1 + (100 - quality) * 0.09 : 53.0 / 3000.0 * quality * quality - 23.0 / 20.0 * quality + 25.0; } Corresponding values:
Quality Distance 100 0.0 90 1.0 80 1.9 70 2.8 60 3.7 50 4.6 40 5.5 30 6.4 20 9.0(6) 10 15.2(6) 0 25.0
Oh I see. Then is a tooltip on the quality slider possible? If not, you can close this issue.
Thank you very much :)
If you really need distance, you can use the table above for the reference.
If more people ask, I'll consider it, but generally people prefer to use the Quality rate control in image converters. If this provided a tangible benefit, sure, but here it's just an abstraction. It does require a fundamental change to the UI logic so maybe another time.