Lymphatus / caesium-image-compressor

Caesium is an image compression software that helps you store, send and share digital pictures, supporting JPG, PNG, WebP and TIFF formats. You can quickly reduce the file size (and resolution, if you want) by preserving the overall quality of the image.
https://saerasoft.com/caesium
GNU General Public License v3.0
3.47k stars 209 forks source link

Skip overiding/producing file if output file is near 0% #235

Open the-liquid-metal opened 10 months ago

the-liquid-metal commented 10 months ago

I have a bunch of files which i don't know whether it already compressed or not. Usually i (re)compressed those files to determine the status. This is laborious task and wasting time.

Cesium is able to calculate the percentage of the output file and determine whether the output file is larger than the source file or not. I use these parameters to determine whether my files have been compressed or not. A file is considered compressed if the percentage is close to 0%. I usually use 2% as a threshold.

It would be helpful if Cesium can set configurable threshold to skip overriding/producing already compressed file. Moreover the info text "skipped: below the threshold" shold be shown.

Lymphatus commented 9 months ago

This is an interesting suggestion, even though I have other plans to address your specific issue. Linked to #49 the idea is to build a local database of already compressed files, so Caesium knows if a file needs to be re-compressed or not.

You suggestion may still be useful in other scenarios, where - for example - you don't want to risk a loss of quality for just a small % of compression.

the-liquid-metal commented 9 months ago

... to build a local database of already compressed files...

I am not a fan of external meta file:

If there must be metadata, then it must be stored in that file too #237

Some applications already perform compression when manipulating images, so cesium will always perform compression even if the file is already compressed efficiently if the meta file does not exist.