def get_paddings(height, width, factor):
    """
    Compute number of pixels to add on each side to respect factor requirement.
    :param height: Image height
    :param width: Image width
    :param factor: Image dimensions must be divisible by factor
    :return: Number of pixels to add on each side
    """

    if height % factor == 0:
        top = 0
        bottom = 0
    else:
        pixels = factor - height % factor
        top = int(pixels / 2)
        bottom = pixels - top

    if width % factor == 0:
        left = 0
        right = 0
    else:
        pixels = factor - width % factor
        left = int(pixels / 2)
        right = pixels - left

    return (top, bottom, left, right)