diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-07-03 16:24:28 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-07-03 16:24:28 -0500 |
commit | 3206d31af5a348a63e200e245b76df8c1294a58d (patch) | |
tree | 14c0bfba73577dd3752db2b54c6f96e2f10f9d13 | |
parent | a04b5352310727f20b38e360006feeca94b7201f (diff) | |
download | libpng-3206d31af5a348a63e200e245b76df8c1294a58d.tar.gz |
[png2uri] Started png2uri branch and added "png2uri" script.png2uri-1.0.0
-rwxr-xr-x | png2uri | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/png2uri b/png2uri new file mode 100755 index 000000000..0c06f9bb0 --- /dev/null +++ b/png2uri @@ -0,0 +1,49 @@ +#!/bin/sh +# +# png2uri +# +# NO COPYRIGHT RIGHTS ARE CLAIMED TO THIS SOFTWARE. +# +# To the extent possible under law, the author has waived all copyright and +# related or neighboring rights to this work. This work is published from +# the United States of America in 2012. +# +# This png2uri software may be used freely in any way. +# +# The source is the original work of the person named below. No other person +# or organization has made contributions to this work. +# +# ORIGINAL AUTHORS +# The following people have contributed to the code or comments in this +# file. None of the people below claim any rights with regard to the +# contents of this file. +# +# Glenn Randers-Pehrson <glennrp@users.sourceforge.net> +# +# png2uri is a command-line application that creates an HTML "img" tag on +# standard output containing a data URI, from a PNG file or from standard +# input. +# +# Usage: png2uri [file] +# +# Requires /bin/sh and a uuencode(1) that takes the "-m" option to mean +# to encode in base64. +# +# If you prefer a web-based converter or a java application, this isn't +# it. Use your search engine and look for "png data uri" to find one. +# + +case x$1 in + x) + # Convert standard input. + echo "<img alt=\"PNG\" title=\"PNG\" src=\"data:image/png;base64," + uuencode -m PNG |grep -v base64|grep -v ==== + echo "\">" + ;; + *) + # Convert the named file. + echo "<img alt=\"$1\" title=\"$1\" src=\"data:image/png;base64," + uuencode -m $1 $1 |grep -v base64|grep -v ==== + echo "\">" + ;; +esac |