Skip to content

Instantly share code, notes, and snippets.

@fmal
Forked from sousk/png2minb64.sh
Created May 9, 2013 17:39
Show Gist options
  • Select an option

  • Save fmal/5549135 to your computer and use it in GitHub Desktop.

Select an option

Save fmal/5549135 to your computer and use it in GitHub Desktop.
fs8=`ruby -e "print '$1'.sub(/\.png$/, '-fs8.png')"`
if test -e "$fs8"; then
rm $fs8
echo "rm $fs8\n"
fi
todataURI()
{
openssl base64 -in $fs8 | awk -v ext="png" '{ str1=str1 $0 }END{ print "data:image/"ext";base64,"str1 }' | pbcopy
}
pngquant -verbose 256 $1;
optipng -o7 -out $fs8 $fs8 && todataURI $1 && echo "copied $fs8\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment