imgmin
imgmin copied to clipboard
Checking if lossless png is more efficient
I know this project is to optimize lossy compression, but I guess there are many cases in which lossless compression actually yields better compression rate at superior quality. Examples could be backgrounds with gradients or images with unicolor areas.
Would it be possible to simply generate a PNG for such 'usual suspects' and see if its size is lower than the JPG?
Yes, probably based on the number of colors in the image.
On OS X you can compile pngquant
with Cocoa reader which gives it JPG support and then run:
pngquant --skip-if-larger input.jpg -o output.png