if (height > width) {
newHeight = maxHgt;
newWidth = (width * newHeight) / height;
} else {
newWidth = maxWdt;
newHeight = (height * newWidth) /width;
}
if (height > width) {
newHeight = maxHgt;
newWidth = (width * newHeight) / height;
} else {
newWidth = maxWdt;
newHeight = (height * newWidth) /width;
}