Skip to content

Instantly share code, notes, and snippets.

@fike
Created February 24, 2013 03:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fike/5022402 to your computer and use it in GitHub Desktop.
Save fike/5022402 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Simple script to length image optimization.
# Fernando Ike - fike@midstorm.org.
#
#
#
DIR=$HOME/d/octopress/source/images
CONVERT=$(which convert)
PNGCRUSH=$(which pngcrush)
LS=$(which ls)
MV=$(which mv)
for i in $($LS $DIR/*.jpg)
do
$CONVERT -strip -interlace Plane $i $i.new > /dev/null
$MV $i.new $i
done
for i in $(LS $DIR/*.png)
do $PNGCRUSH -rem alla -brute -reduce $i $i.new > /dev/null
$MV $i.new $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment