Grayscale to RGB transform

perhaps you can check that. The question was basically about a function that can be used as part of transforms.Compose.