Created
June 24, 2018 14:02
-
-
Save ngryman/3ae53313e0667e9307586d105d1d257f to your computer and use it in GitHub Desktop.
Keep the aspect ratio of your images using GIFs
This file contains 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
function createGif(width, height) { | |
const b64wh = btoa( | |
String.fromCharCode(width & 0xFF) + | |
String.fromCharCode(width >> 8 & 0xFF) + | |
String.fromCharCode(height & 0xFF) + | |
String.fromCharCode(height >> 8 & 0xFF) + | |
String.fromCharCode(0) + | |
String.fromCharCode(0) | |
) | |
return `R0lGODlh${b64wh}ACwAAAAAAQABAAAC` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment