Closed rfezzani closed 1 year ago
I haven't looked in detail, but the level
parameter does map to distance
in the latest version of imagecodecs. The mapping function is taken from the libjxl
source code . See also discussion at #54.
It looks like you are using an outdated version of imagecodecs.
You are right, I am running the penultimate version :sweat_smile:
>>> import imagecodecs
>>> print(imagecodecs.__version__)
2022.9.26
Thank you again @cgohlke!
After reading the code lines you pointed me, the distance
needs to be None
for level
to affect the compression quality.
Here are the corresponding measure curves if you are interested:
It is interesting to see how decoding speeds up when level > 60
I performed few experiments trying to understand the effect of the different parameters of
jpegxl_encode
, and I found that only thedistance
parameter affects the output size and the image quality.Generally, in other formats (JPEG, JPEGXR, JPEG2000, AVIF), the
level
parameter is used to set compression quality and size. What about makinglevel
parameter injpegxl_encode
depend on the actualdistance
parameter for consistency?Here are the results of my experiments:
Evaluation
Using two test images from
skimage
(cat and astronaut), I measured 4 quantities: output size, Normalized root MSE (NMSE) and finally encoding and decoding time:Results
Measures on both test images are consistent:
Effort parameter influence
NMSE and output size are marginally affected by the
effort
parameterLevel parameter influence
effort
is set to 3 Again, NMSE and output size are marginally affected by thelevel
parameterdistance parameter influence
effort
is set to 3 andlevel
to 4NMSE and output size are controled by the
distance
parameter