There are lots of different loss functions you could use, depending on how simple you want to make things, and what aspect of image similarity you care about.  It’s a huge field with lots of ongoing active research.  Some keywords to search are “perceptual similarity” “image similarity metric” “structural similarity”.
The simplest thing you could do is use MSE (Mean Squared Error).