Merge "Fix crash when number of pixels < max colors" into sc-dev