Created
May 2, 2017 16:43
-
-
Save marcelaraujo/79f3001df2e92f3f63a4df29097b3171 to your computer and use it in GitHub Desktop.
Image 1x1 blob
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From http://stackoverflow.com/questions/14967647/ (continues on next line) | |
| // encode-decode-image-with-base64-breaks-image (2013-04-21) | |
| function fixBinary (bin) { | |
| var length = bin.length; | |
| var buf = new ArrayBuffer(length); | |
| var arr = new Uint8Array(buf); | |
| for (var i = 0; i < length; i++) { | |
| arr[i] = bin.charCodeAt(i); | |
| } | |
| return buf; | |
| } | |
| var binary = fixBinary(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGP6DwABBQECz6AuzQAAAABJRU5ErkJggg==")); | |
| var image = new Blob([binary], {type: 'image/png'}); | |
| image.name = 'pixel.png'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment