From: Aahz on
In article <5YudnaFysO8HouTWnZ2dnUVZ_tidnZ2d(a)westnet.com.au>,
R (Chandra) Chandrasekhar <chyavana(a)gmail.com> wrote:
>
>---
>import subprocess
>
>width = 5
>height = 30
>colors = ['#abcdef]', '#456789']
>filename = "/tmp/image.png"
>
># I want to get the equivalent of variable interpolation in Perl
># so that the command
>#
># convert -size 5x30 gradient:#abcdef-#456789 /tmp/image.png

Here's the equivalent of Peter's cute code in simpler form:

cmd = [
'convert',
'-size',
'%sx%s' % (width, height),
'gradient:%s-%s' % tuple(colors),
# above could also be: 'gradient:%s-%s' % (colors[0], colors[1]),
filename,
]
subprocess.Popen(cmd)
--
Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just
refer to comments in code as 'lies'. :-)"