Open ruidge opened 3 years ago
I write a script to compress all png in the project. the command is ' pngquant --skip-if-larger --speed 1 --nofs --strip --force --output "xx.png" -- "xx.png" '. It works well in 1st time compress, but the script still compress some png in 2nd, 3rd time . I compare the result the 2nd or 3rd compress just reduce 0.0x kb or 0.x kb size. What can I do to avoid these compress.(avoid compress same png multi times ). custom command args or record png name myself or other graceful?
I use ImageMagick to see png's metadata and compare the compressed and origin meta, and list some diff: change Type (TrueColorAlpha -> PaletteAlpha); change Red ,Green, Blue's min ,add Histogram ; then I update the script, read the meta before compress , only compress when Type != PaletteAlpha, is this fine?
You can skip PNG files that have type PaletteAlpha.
Or you don't have to do anything — if you don't use quality
setting, then pngquant won't do anything to such files.
You can skip PNG files that have type PaletteAlpha.
Or you don't have to do anything — if you don't use
quality
setting, then pngquant won't do anything to such files.
so what cause 0.0x kb or 0.x kb's reduce and what is --quality default value(s)?
quality default is 0-100, which means it does as good as it can, accepts any result. for png8 it always achieves 100%.
small reduction can be due to lossless recompression.
quality default is 0-100, which means it does as good as it can, accepts any result. for png8 it always achieves 100%.
small reduction can be due to lossless recompression.
If so, I may compress all png every time. by the way, how about pngquant compatibility on mobile devices, Android, iOS, web on chrome ?
PNG written by pngquant are standard and work on all platforms.
I write a script to compress all png in the project. the command is ' pngquant --skip-if-larger --speed 1 --nofs --strip --force --output "xx.png" -- "xx.png" '. It works well in 1st time compress, but the script still compress some png in 2nd, 3rd time . I compare the result the 2nd or 3rd compress just reduce 0.0x kb or 0.x kb size. What can I do to avoid these compress.(avoid compress same png multi times ). custom command args or record png name myself or other graceful?