Lymphatus / caesium-clt

Caesium Command Line Tools - Lossy/lossless image compression tool
http://saerasoft.com/caesium
Other
357 stars 34 forks source link

Use dedicated flag for lossless compression #75

Open stamminator opened 1 month ago

stamminator commented 1 month ago

Currently, --quality 0 is used to indicate lossless compression. I think it would be an improvement to instead use a dedicated -l, --lossless flag for the following reasons:

The rules should probably be that a command must have either the --lossless flag or the --quality option set, with --quality either being ignored when --lossless is set or resulting in an error being thrown.

The bad part about this is it would be a breaking change, requiring people's scripts to be modified and a version jump to 1.x if you plan to use semver.

Lymphatus commented 1 month ago

Having a dedicated --lossless flag was on my radar for a long time, but I basically had the same doubts you're pointing out.

I'm not too worried about backward compatibility, as we are still on a 0.x.y release, so breaking changes are expected.

Having 0 as the "lossless value" is a very legacy heritage from the early days of this tool, when 0 was not allowed for quality. Now it is - at least for JPEG, PNG and WebP - so I think your solution is viable. It requires libcaesium to be modified a little bit, but it's not a big deal.