Created
May 10, 2017 19:16
-
-
Save diogomachado/584c93a447114a8a65e6d9aff0ce5581 to your computer and use it in GitHub Desktop.
Javascript - Reduzir imagem proporcionalmente
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
// Valores da imagem original | |
var width = 600, height = 300; | |
// Redução desejada | |
var width_new = 300; | |
// Novo tamanho baseado na redução | |
var height_new = Math.round(((height/width) * width_new)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment