siiptuo / pio

Optimize images while maintaining the same perceived quality
138 stars 10 forks source link

Add auto chroma subsampling feature #20

Closed joppuyo closed 3 years ago

joppuyo commented 3 years ago

Add feature to automatically determine chroma subsampling for JPEG images.

While most images are optimal with 420 chroma subsampling, some images with high contrast colors have a smaller file size with 422 or 444 subsampling. This PR adds a feature where all subsamplings are tested when compressing JPEG files and the subsampling with closest SSIM is selected.

This feature is on by default but can be disabled by specifying chroma subsampling manually, for example:

pio image.jpg --output output.jpg --chroma-subsampling=420

Fixes #13