def parse_dimension(value, original_dimension):
    """
    Returns an int dimension value from a string input (in number or percent).
    """
    try:
        return int(value)
    except ValueError:
        if value.rfind('%'):
            return int(int(value.split('%')[0]) * original_dimension / 100)
        raise
