Wrote the overlay image function.

Defined the functionality of the overlay function.