-
-
Save parzibyte/2fda5ff300e1c1a8f3b27dd7ef957c42 to your computer and use it in GitHub Desktop.
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
const imagen = new Image(); | |
imagen.src = "http://localhost/pusheen.png"; | |
imagen.crossOrigin = "anonymous"; | |
imagen.onload = () => { | |
let medidaMayor = imagen.width; | |
if (imagen.height > medidaMayor) { | |
medidaMayor = imagen.height; | |
} | |
$canvas.width = medidaMayor; | |
$canvas.height = medidaMayor; | |
context.drawImage(imagen, 0, 0); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment