Strip ICC headers from png files to silence warning

This commit is contained in:
Flakebi 2015-06-05 03:26:24 +02:00
parent 9531f0b3a4
commit 41002fc262

View File

@ -20,6 +20,7 @@ jpegtran=true
advdef=true
advzip=true
optipng=true
convert=true
#WARNING! SETTING TO TRUE MAY POSSIBLY INCREASE LOAD TIMES ON A SLOW CPU (UNTESTED) OR LEAD TO FILE NOT FOUND ERRORS WHEN RUNNING SUPERTUXKART!
compress_b3d=false
@ -58,6 +59,13 @@ then
sleep 2
fi
#check for convert
if [ ! $(which convert) ]
then
echo "convert is not installed, therefore it will not be used."; convert=false
sleep 2
fi
#check for optipng
if [ ! $(which optipng) ]
then
@ -83,6 +91,14 @@ BEFORE=`du -sk | awk '{print $1}'`
#functions for xargs multithreading, used instead of GNU parallel for cross-compatibility
#TODO: let next set of optimization scripts run if one set is stuck on a single file at the end to decrease total runtime
#strip ICC information off PNG's
strippng () {
for arg; do
convert "$arg" -strip "$arg"
done
}
export -f strippng
#optimize PNG's
optimpng () {
for arg; do
@ -121,6 +137,12 @@ done
export -f recomprb3dz
#END MULTITHREADING FUNCTIONS
#strip png icc information
if [ "$convert" = true ]; then
find . -path .svn -prune -o -name "*.png" -print0 | xargs -0 -n 1 -P "$threads" bash -c 'strippng "$@"' -- #multithread the png stripping
else echo "convert not installed. Ignoring commands using convert..."; sleep 1
fi
#lossless png image optimization
if [ "$optipng" = true ]; then
find . -path .svn -prune -o -name "*.png" -print0 | xargs -0 -n 1 -P "$threads" bash -c 'optimpng "$@"' -- #multithread the png optimization