Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save diogomachado/584c93a447114a8a65e6d9aff0ce5581 to your computer and use it in GitHub Desktop.
Save diogomachado/584c93a447114a8a65e6d9aff0ce5581 to your computer and use it in GitHub Desktop.
Javascript - Reduzir imagem proporcionalmente
// 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