If there is a way to do, then convert
is your friend.
I have used convert
for many things, but not specifically for this. Also, whther you actually have a background color in your images is a question -- it may just be a part of the image which has the same color as the background (which is subtle different) -- however even in that case convert
may be able to help.
Looking at man convert
there is an option for changing background color.
There is also a option opaque
to change a particular color into the background color.
So playing around with your particular images, and the options you may find what works for your images.
Then the final step would be to write a small shell script to loop though all your images, like this
mkdir converted_img
for img in $(ls orig_image/*) ; do
convert {insert-options-which-does-the-job} orig_image/$img converted_img/$img
done
and you should be all done
#FFFFFF
white with another color? What do you mean by "modify"? Please edit the question to include some more details, otherwise we won't be able to help you.