Base64
https://github.com/blueimp/JavaScript-Canvas-to-Blob
https://github.com/beatgammit/base64-js
https://github.com/dankogai/js-base64
Encode to base64:
recode ../b64 < file.png, base64 -w 0 < file.png, openssl enc -base64 < file.png | tr -d '\n' or uuencode. add | pbcopy to copy in clipboard (OSX) or > file.b64
base64 -w 0 < file.png | pbcopyfunction dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}Decode from base64:
pbpaste | base64 -d > file.pngLast updated
Was this helpful?