public Size GetComputedImageSize(int width, int height)
{
if (width > 400)
{
var divisor = Convert.ToDouble(width) / 400;
var tHeight = Math.Round(Convert.ToDouble(height / divisor), 0, MidpointRounding.AwayFromZero);
var size = new Size
{
Height = Convert.ToInt32(tHeight),
Width = 400
};
return size;
}
return new Size(width, height);
}