Packs integer values from a 2D ndarray into an RGB one for storing as compressed images