Base64 Text to Image translation sylvain.poll Follow 2011-03-03 21:56:43 License: MIT License Fork0 Fav4 View1111 Play Stop Reload Fullscreen Smart Phone Readme JavaScript 59 lines HTML 5 lines CSS 2 lines Traduction of text base 64 encoded to bitmap data Useless and fun. Base64 Text to Image translation function drawImage() { document.getElementById("image").setAttribute("src", //bitmap file header "data:image/bmp;base64,Qk12BAAAAAAAADYEAAAoAAAACAAAAAgAAAABAAgAAAAAAAAAAADEDgAAxA4AAAABAAAAAQAA" +getBase64Code()); } function getBase64Code() { var encode = encode64(document.getElementById("input").value).replace(/=/g,""); while(encode.length<15) encode=encode+encode; encode+="/"; while(encode.length<1492) encode=encode+encode; return encode.substring(0,1492); } var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "="; function encode64(input) { input = escape(input); var output = ""; var chr1, chr2, chr3 = ""; var enc1, enc2, enc3, enc4 = ""; var i = 0; do { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return output; } drawImage(); Base64 Text to Image Translation <br/> <img id="image" width="8" height="8" alt=""> <br /> Type something here : <input type="text" id="input" max="10" onkeydown="drawImage()" value="rainbow" /> Base64 Text to Image translation body { background-color: #DDDDDD; font: 20px sans-serif; text-align:center } #image {width:256px; height:256px; } Traduction of text base 64 encoded to bitmap data Useless and fun. function drawImage() { document.getElementById("image").setAttribute("src", //bitmap file header "data:image/bmp;base64,Qk12BAAAAAAAADYEAAAoAAAACAAAAAgAAAABAAgAAAAAAAAAAADEDgAAxA4AAAABAAAAAQAA" +getBase64Code()); } function getBase64Code() { var encode = encode64(document.getElementById("input").value).replace(/=/g,""); while(encode.length<15) encode=encode+encode; encode+="/"; while(encode.length<1492) encode=encode+encode; return encode.substring(0,1492); } var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "="; function encode64(input) { input = escape(input); var output = ""; var chr1, chr2, chr3 = ""; var enc1, enc2, enc3, enc4 = ""; var i = 0; do { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return output; } drawImage(); Base64 Text to Image Translation <br/> <img id="image" width="8" height="8" alt=""> <br /> Type something here : <input type="text" id="input" max="10" onkeydown="drawImage()" value="rainbow" /> body { background-color: #DDDDDD; font: 20px sans-serif; text-align:center } #image {width:256px; height:256px; } use an iframe compat browser, deer Play on jsdo.it games Author Share ブログに埋め込む QR Tag Download Complete! Description What kind of game? Traduction of text base 64 encoded to bitmap data Useless and fun. Control Device Smartphone Controllerjsdo.it WebSocket Controller» Mouse Keyboard Touch Device Fullscreen Activated Inactivated jsdo.it games から削除する Submit Author sylvain.pollet.villard URLhttp://syllab.fr Tweet Default Panel Auto play Screenshot Readme JavaScript HTML CSS Size Width: px Height: px code <script type="text/javascript" src="http://jsdo.it/blogparts/jXZH/js"></script> base64 bitmap data encode encoding fun image Tweet Twitter Discussion Questions on this code? Tags base64 bitmap data encode encoding fun image Favorite by yuya kyo_ago gryng02 ethertank: base64