mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Export to GIF
This commit is contained in:
18
js/lib/gif/b64.js
Normal file
18
js/lib/gif/b64.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function encode64(input) {
|
||||
var output = "", i = 0, l = input.length,
|
||||
key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
while (i < l) {
|
||||
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 + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user