Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduce a MAX_CORES variable.

  • Loading branch information...
commit d00f7e3f57edd2f278871d4c35ae080c08edbde9 1 parent 4629ee8
@stefanbeller authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 image_optim.sh
View
9 image_optim.sh
@@ -45,7 +45,7 @@ jpeg_remove_comment_and_exiv()
{
print "Removing comments and exiv data from jpegs."
timestart
- git ls-files ./ | grep -e "\.jpg$" -e "\.jpeg" | xargs -P 0 -n 1 jpegoptim --strip-all >> /tmp/mytrimage_jpeg.log
+ git ls-files ./ | grep -e "\.jpg$" -e "\.jpeg" | xargs -P ${MAX_CORES} -n 1 jpegoptim --strip-all >> /tmp/mytrimage_jpeg.log
timeend
print "$TD"
}
@@ -54,9 +54,9 @@ png_optimize_all()
{
timestart
print "starting to optimize pngs"
- git ls-files ./ | grep "\.png$" | xargs -P 0 -n 1 optipng -zc1-9 -zm1-9 -zs0-3 -f0-5 >> /tmp/mytrimage_png.log
- git ls-files ./ | grep "\.png$" | xargs -P 0 -n 1 advpng -z4 >> /tmp/mytrimage_png.log
- git ls-files ./ | grep "\.png$" | xargs -P 0 -n 1 -I '{}' pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time {} {}.foo >> /tmp/mytrimage_png.log
+ git ls-files ./ | grep "\.png$" | xargs -P ${MAX_CORES} -n 1 optipng -zc1-9 -zm1-9 -zs0-3 -f0-5 >> /tmp/mytrimage_png.log
+ git ls-files ./ | grep "\.png$" | xargs -P ${MAX_CORES} -n 1 advpng -z4 >> /tmp/mytrimage_png.log
+ git ls-files ./ | grep "\.png$" | xargs -P ${MAX_CORES} -n 1 -I '{}' pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time {} {}.foo >> /tmp/mytrimage_png.log
for i in $(git ls-files ./ | grep "\.png$") ; do
if [[ `du -b $i | awk '{print $1}'` -gt `du -b $i.foo | awk '{print $1}'` ]] ; then
@@ -70,6 +70,7 @@ png_optimize_all()
}
VERBOSE=true
+MAX_CORES=8
timestartglobal
jpeg_remove_comment_and_exiv
png_optimize_all
Please sign in to comment.
Something went wrong with that request. Please try again.