#! /usr/bin/env python

import os
import subprocess

svg_src = open('screen-with-capture.svg').read()
for filename in os.listdir('captures'):
    svg_dst = svg_src.replace('xxx.png', 'captures/%s' % filename)
    svg_path = open('/tmp/.xxx.svg', 'w')
    svg_path.write(svg_dst)
    svg_path.close()
    subprocess.call(['inkscape', '--without-gui',
        '--file', '/tmp/.xxx.svg',
        '--export-area-drawing',
        '--export-area-snap',
        '--export-png', 'screen-%s' % filename,
        '--export-width', '250'])

# gm montage screen-*.png -geometry +10+0 -tile 8x1 -background none ../screens.png
# +10+0 <- 10 is the margin
# 8x1   <- 8 is the number of images
