Selects tiles by avg and outputs an image with tiles. The avg method doesn't work too well