Skip to content

Instantly share code, notes, and snippets.

@cantlin
Created October 3, 2012 16:28
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cantlin/3828068 to your computer and use it in GitHub Desktop.
#! /bin/bash
x=`identify -format "%w" $1`
y=`identify -format "%h" $1`
data=`openssl base64 < $1 | tr -d '\n'`
type=`file --mime-type -b $1`
echo "display:block;
font:0/0 a;
color:transparent;
width:"$x"px;
height:"$y"px;
background:url('data:"$type";base64,"$data"');" | pbcopy
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment