By default, oxipng will only decide to not write a file if the optimized file is equal to (or, presumably in theory, greater than) the size of the original file. Writing can be forced with --force so that files are always written, but there is currently no way to go in the other direction and specify a minimum compression ratio that must be met before writing.
The reason I want this feature is that, if a file can only be compressed by a few bytes, it's not worth doing so for files stored in Git, since the benefit is small and it comes with the downside of increasing the size of the Git repo. I'm only interested in files that can see a significant amount of compression (I've noticed some can be reduced to half the size, for example).
I would like to specify a minimum compression threshold, so that if a file was only able to be compressed by, for example, less than 1 percent, then oxipng would not save the compressed file, but if the file was compressed by ex: 2% then it would be saved.
By default,
oxipng
will only decide to not write a file if the optimized file is equal to (or, presumably in theory, greater than) the size of the original file. Writing can be forced with--force
so that files are always written, but there is currently no way to go in the other direction and specify a minimum compression ratio that must be met before writing.The reason I want this feature is that, if a file can only be compressed by a few bytes, it's not worth doing so for files stored in Git, since the benefit is small and it comes with the downside of increasing the size of the Git repo. I'm only interested in files that can see a significant amount of compression (I've noticed some can be reduced to half the size, for example).
I would like to specify a minimum compression threshold, so that if a file was only able to be compressed by, for example, less than 1 percent, then
oxipng
would not save the compressed file, but if the file was compressed by ex: 2% then it would be saved.