fix: added clamping when input number of colors to extract is greater than the actual colors in image