def trim_percentage(img, percentage):
    """
    Trim percentage of pixels off images

    :parameters:
        - percentage: int
            percentage of dimension to trim off.
            both sides are trimmed, half each side.

    >>> img = Image.new('L', (100, 200))
    >>> imgt = trim_percentage(img, 10)
    >>> imgt.size
    (90, 180)
    """
    px_w = img.size[0] * (percentage / 100.0)
    px_h = img.size[1] * (percentage / 100.0)
    box = map(int, (px_w / 2, px_h / 2, img.size[0] - px_w / 2, img.size[1] -
        px_h / 2))
    img = img.crop(box)
    return img
