JSFiddle - React, Tailwind, and code Playground
HTML
<img id="logo" src="http://jsfiddle.net/img/logo.png" />
JavaScript
function resizeImgByArea(imgId, avgDimension){
var node, w, h, oldArea, oldAvgDimension, multiplicator, targetHeight, targetWidth;
node = $('#' + imgId);
w = node.width();
h = node.height();
oldArea = w*h;
oldAvgDimension = Math.sqrt(oldArea);
multiplicator = avgDimension / oldAvgDimension;
targetHeight = h * multiplicator;
targetWidth = w * multiplicator;
node.width(targetWidth);
node.height(targetHeight);
}
$(function(){
resizeImgByArea('logo', 50);
})