Python and the Background Image

In the past, I’ve loaded up reference images into the background of the mesh viewer to use as a modelling reference. Now I’d like to try something a little like rotoscoping, with the background image being a frame from a movie.

What I need is a way to change the image with a python script. I figure I can tie the script to frame movements and have it replace the exisitng background image with the image from the movie frame I’ve moved to. But is there an interface for Python to change the filename? As far as the movie itself, I figure I’d break that into PNG files for each frame beforehand or work out something more clever with pygst or something, so I have that covered. I just need a way of getting to the background image property in Blender.

You know about using movie frames as animated Image textures, right?

Just found out about that here:
https://blenderartists.org/forum/viewtopic.php?t=43027&highlight=rotoscoping

Excellent. I’ll definitely use that rotoscoping technique instead.

Still, I am curious to hear if there is a way to modify that background image via Python, just in case I get any other ideas that will require that (such as only have a collection of key frames from a movie appear every 20 or so frames in the background, just as an example).