def static_full_sizes(width, height, tilesize):
    """Generator for scaled-down full image sizes.

    Positional arguments:
    width -- width of full size image
    height -- height of full size image
    tilesize -- width and height of tiles

    Yields [sw,sh], the size for each full-region tile that is less than
    the tilesize. This includes tiles up to the full image size if that
    is smaller than the tilesize.
    """
    for level in range(0, 20):
        factor = 2.0 ** level
        sw = int(width / factor + 0.5)
        sh = int(height / factor + 0.5)
        if sw < tilesize and sh < tilesize:
            if sw < 1 or sh < 1:
                break
            yield [sw, sh]
