def calc_height(thumb_width, viewport):
    """
    Figure out the height based on the viewport/thumbnail_max_width
    """
    width, height = map(int, viewport.split('x'))
    ratio = float(thumb_width) / width
    return int(height * ratio)
