A useful function to merge layers of two pictures.