Based on your code snippet I would suggest to apply the transformation in the image arrays before normalizing them with the StandardScaler.
I.e. you could permute X_train_img before dividing the data by 255. and pass each image, which should be transformed to your transformation. Since PIL.Images are expected you would need to create them via PIL.Image.fromarray.
I don’t understand the assignment of numerical data to the augmented images and am not sure if this is shown in the code snippet.