20.5 Export and Production

You can export the layers manually, but that would be rather frustrating—especially since you may need to do it more than once after viewing the result and making changes to the source. Since Inkscape offers a powerful set of command-line parameters, I wrote another Python script to automate the export. The script takes as parameters the name of source file, the numbers of the start and end layers to export, and the name of the resulting GIF; it then calls Inkscape to export each layer separately. After exporting, this script calls the convert utility from ImageMagick for combining the frames into an animated GIF file which can then be viewed in any graphic web browser.

import os, sys for i in range(int(sys.argv[2]), ...

Get The Book of Inkscape now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.