[SciPy-user] How to save image from a window
Lorenzo Isella
lorenzo.isella at gmail.com
Thu Apr 17 05:33:01 EDT 2008
Dear All,
I have already posted this to the visual python mailing list, but with
no success.
The problem is the following: I want to make a movie using Python tools.
The short script I paste below (it needs visual python) plots a chain of
spheres in a window.
How can I automatically save the window into e.g. a jpeg file?
I need automation because I aim at generating O(100) jpeg files for my
movie.
I was suggested to use the PIL (python image library) and the ImageGrab
module, but this seems to be available for Windows only.
Any suggestion?
Here is the code:
#! /usr/bin/env python
import scipy as s
import numpy as n
import pylab as p
import visual as v
x_list=s.arange(10)
y_list=s.zeros(10)
y_list[:]=1.
z_list=y_list
my_rad=1.
particles=[v.sphere(pos=loc,radius=my_rad,color=v.color.blue)\
for loc in zip(x_list,y_list,z_list)]
Now you should see a window with a line of spheres.
How would you save that to a file (without e.g. using Gimp and clicking
here and there)?
In case it matters, I am running Debian testing on my box.
Many thanks
Lorenzo
More information about the SciPy-User
mailing list