pngcheck
can detect non-PNGs:find -name '*.png' -exec pngcheck -q '{}' +
- GIMP GUI (unlike *Magick or Script-Fu, which are buggy) can properly convert to sRGB (remember to overwrite the original for each one):
- Open in GIMP (press Ctrl-C once it stops opening windows for a while):
find -name '*.png' -exec sh -c "pngcheck -v '{}' | grep -q 'chunk iCCP' && echo \"\\\"{}\\\"\"" \; | xargs gimp & while true; do window_id=$(wmctrl -l | grep -Pom 1 "^(0x[0-9a-f]{8})(?=\s.+ Convert to RGB working space\?$)"); if [ "$window_id" != "" ]; then xsendkey -window $window_id "Alt+C"; fi; sleep 1; done
- Convert and overwrite originals:
wmctrl -l | grep -Po "^(0x[0-9a-f]{8})(?=\s.+ GIMP$)" | while read window_id; do echo Handling window $window_id; xsendkey -window $window_id Alt+i; xsendkey -window $window_id m; xsendkey -window $window_id c; until (wmctrl -l | grep -Poq "^(0x[0-9a-f]{8})(?=\s.+ Convert to ICC Color Profile$)"); do sleep 1; done; wmctrl -l | grep -Po "^(0x[0-9a-f]{8})(?=\s.+ Convert to ICC Color Profile$)" | while read dialog_id; do echo Handling dialog $dialog_id; wmctrl -iR $dialog_id; xsendkey -window $dialog_id Alt+b; xsendkey -window $dialog_id Alt+b; xsendkey -window $dialog_id Down; xsendkey -window $dialog_id Right; xsendkey -window $dialog_id space; while (wmctrl -l | grep -q $dialog_id); do sleep 1; done; done; xsendkey -window $window_id Alt+f; xsendkey -window $window_id w; sleep 1; xsendkey -window $window_id Control+z; wmctrl -ic $window_id; done
- My custom script for the Linux version of PNGOUT can find the best PNGOUT settings and make a second script that repeatedly tries random Huffman tables with them.
- Once that's done, run AdvPNG 1.17 or later:
find -name '*.png' | xargs -P $(grep -c ^processor /proc/cpuinfo) -n 1 -I{} advpng -z -3 -i 255 '{}'
find -name '*.png' | xargs -P $(grep -c ^processor /proc/cpuinfo) -n 1 -I{} advpng -z -4 -i 10000 '{}'
- Once that's done, run PNGOUT repeatedly:
./compress-all