cap n colors at 265, limit of image.Paletted
avoid crash for n < 1