'Calculate the largest size that preserves aspect ratio which
fits within the given rectangle::
(w_in / h_in) = (w_out / h_out)
w_out = min(w_max, h_max * (w_in / h_in))
h_out = min(h_max, w_max * (h_in / w_in))
Args:
max_width: The largest possible width.
max_height: The larget possible height.'

def aspect(self, max_width, max_height):

    if ((max_width * self.height) < (max_height * self.width)):
        return (max_width, ((max_width * self.height) // self.width))
    else:
        return (((max_height * self.width) // self.height), max_height)
