JacobDev1 / xl-converter

Easy-to-use image converter for modern formats. Supports multithreading, drag 'n drop, and downscaling.
https://codepoems.eu/xl-converter
Other
118 stars 4 forks source link

Feature request: JPEGLI encoder - option for chroma subsampling (4:4:4, 4:2:2 and 4:2:0) #18

Closed JamesPous closed 2 months ago

JamesPous commented 3 months ago

First thank you for your hard work and great tool for picture conversion! It is one of the first one which efficiency use the new jpeg encoder jpegli with fantastic results in quality and size.

I intense tested the jpegli encoder of the JPEGXL 0.10.2 package under windows and some settings are very interesting for better compression and an equal good quality.

The settings for chroma sub sampling (switch e.g. --chroma_subsampling=420) would be a nice option to reduce the filesize with very small quality reduction.

I tried to analyse your sourcecode, but did not find the programcode which set the chroma subsampling.

If you want to enhance your xl-converter it would be nice to set chroma subsampling (4:4:4, 4:2:2 or 4:2:0).

Further there is an option for progressive jpeg (--progressive_level=0..2). You can save further space for the saved picture.

Do your program use it or is there a default value?

JacobDev1 commented 3 months ago

Hello,

in 0.9.8 the program lets the CJPEGLI encoder choose the parameters.

Changing chroma subsampling does worsen the quality. Adding one chroma subsampling option would call for adding it to all formats. I might get back to it at some point, but not this moment.

As for progressive scan, you're right. Thanks for pointing this out. This will be off by default in the next release with an option to turn it back on.

JamesPous commented 3 months ago

For important or colorful photos from camera RAW file I would prefer chroma subsampling 4:4:4, but for jpeg (4:2:0 format) conversions I would choose chroma subsampling 4:2:0 for the destination file.

I converted some jpeg files with your xl-converter with jpegli encoder to jpeg file and they are saved in progressive format. Progressive mode 1 is a bit faster for viewing and progressive mode 2 in jpegli encoder needs more time to display a photo with a small advantage in filesize (5-10 KB - picture size: 2560 x 1920 Pixels).

JacobDev1 commented 3 months ago

Thanks for your feedback.

-p 2 appears to be much smaller than -p 0. The default is -p 2, so I will leave this as it is. Feel free to correct me on that.

Chroma subsampling options would need a new system to accommodate them. Something like a pop up with all advanced options. That is a lot of work. Every format has plenty of parameters to tweak.

I'd love to add every feature people request, but I need to avoid feature creep. I'll postpone these plans for now as there are other things I need to work on.

JacobDev1 commented 3 months ago

Progressive Scan will remain on by default. In 0.9.9 (released today) I've added an option to disable it.

More granular control over formats is planned sometime in the future.

JacobDev1 commented 3 months ago

Chroma subsampling options will be available in XL Converter 1.0 in all formats that support it (AVIF, JPG).

JamesPous commented 2 months ago

That is a good decision. Thank you!

Lark8037 commented 2 months ago

Is it possible to add a Grayscale option as well?

JacobDev1 commented 2 months ago

@Lark8037

This feature is not planned at the moment.

Currently:

To convert color -> grayscale in JPEG XL and JPEGLI, use a different tool like XnConvert to convert to grayscale first.

  1. Add "Change color depth" filter
  2. Set it to grayscale
  3. Convert to PNG
  4. Convert the resulting images with XL Converter