def get_size(self, image_size):
    (w, h) = image_size
    size = random.choice(self.min_size)
    max_size = self.max_size
    if (max_size is not None):
        min_original_size = float(min((w, h)))
        max_original_size = float(max((w, h)))
        if (((max_original_size / min_original_size) * size) > max_size):
            size = int(round(((max_size * min_original_size) / max_original_size)))
    if (((w <= h) and (w == size)) or ((h <= w) and (h == size))):
        return (h, w)
    if (w < h):
        ow = size
        oh = int(((size * h) / w))
    else:
        oh = size
        ow = int(((size * w) / h))
    return (oh, ow)
def get_size(self, image_size):
    (w, h) = image_size
    size = random.choice(self.min_size)
    max_size = self.max_size
    if (max_size is not None):
        min_original_size = float(min((w, h)))
        max_original_size = float(max((w, h)))
        if (((max_original_size / min_original_size) * size) > max_size):
            size = int(round(((max_size * min_original_size) / max_original_size)))
    if (((w <= h) and (w == size)) or ((h <= w) and (h == size))):
        return (h, w)
    if (w < h):
        ow = size
        oh = int(((size * h) / w))
    else:
        oh = size
        ow = int(((size * w) / h))
    return (oh, ow)