The point is that this code does image conversion, and you zapped the color of any image in the atlas and made it grayscale by changing the R, G and B shifts to be the same. Please restore all the shifts to the original values, it looks fine.