dlemstra / Magick.NET

The .NET library for ImageMagick
Apache License 2.0
3.47k stars 415 forks source link

JPEG XL ignores quality setting and only works in lossless mode #828

Closed n00mkrad closed 3 years ago

n00mkrad commented 3 years ago

Prerequisites

Description

Encoding JPEG XL images ignores the quality setting and always uses lossles mode, even though the reference library should support lossy compression.

Steps to Reproduce

Convert an image to JPEG XL with different MagickImage.Quality values

System Configuration

n00mkrad commented 3 years ago

Update: It seems like it's not lossless, but uses a specific compression level, possibly 95. Either way, it ignores MagickImage.Quality.

dlemstra commented 3 years ago

The JXL encoder is super new and only has a minimal feature set. Will need to figure out how we can set the quality in the JPEG-XL library. This might not be possible yet in the current API.

n00mkrad commented 3 years ago

Oh, okay. I thought it would be pretty easy with the reference library.

Take your time then.

n00mkrad commented 3 years ago

I can confirm that the current implementation is NOT lossless:

10x Diff, PNG -> JXL:

png2jxl

10x Diff, JPEG -> JXL:

jpeg2jxl

dlemstra commented 3 years ago

If you want lossless compression you will need to set the quality to 100. That is the only encoder option that is currently implemented.

dlemstra commented 3 years ago

We added support for the quality setting and also setting the effort.