1. you can use Perl to script this. using wget to acquire the image and save it to a dir
2. I would look into image magic, you can use that in conjunction with perl to re-size, flip, cut and place images with other images and save it in the dir where the binary program will read it from. I say Perl, cause i know for a fact imagemagic has a library for it.
3-4. depends on the binary program you are using