#----------------------------------------------------------------------
#saveMovieToFile - Write a list of pictures to files in order.
#movie - A list of pictures.
#dir - The directory where the pictures should be saved.
#name - The starting portion of the filenames. For example if name is "box"
# the filenames will look like "box000.jpg", "box001.jpg" etc.
#firstFrame - Where to start numbering frames. For example if this is 4,
# the first file will be named "box004.jpg".
#----------------------------------------------------------------------
import os
def saveMovieToFile(movie, dir, name, firstFrame):
curFrame = firstFrame
for index in range(len(movie)):
if isinstance(movie[index], Picture):
curName = os.path.join(dir, name + "%03i" % curFrame + ".jpg")
print curName
writePictureTo(movie[index], curName)
curFrame= curFrame+1
Here is an example of calling this function:
>>> saveMovieToFile(movieA, pickAFolder(), 'rectangle', 0)
>>> saveMovieToFile(movieB, pickAFolder(), 'rectangle', 3)
The function