Is there any option to change the background color of an image?

Before loading the image, how can we change the background of the image (if the background is dark, how can we change it into any light color) and displaying it on the host.

This code works fine. But I want to change the background color of my image and display it.