/[gzz]/gzz/gfx/libutil/saveanim.py
ViewVC logotype

Diff of /gzz/gfx/libutil/saveanim.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Fri Nov 15 08:11:44 2002 UTC revision 1.4 by tjl, Sun Nov 17 11:04:52 2002 UTC
# Line 4  from gzz.util import saveimage Line 4  from gzz.util import saveimage
4  from gzz.gfx.gl import GL  from gzz.gfx.gl import GL
5  import os  import os
6    
7  def saveframe(filename, win):  def saveframe(filename, win, x=0, y=0, w=None, h=None):
     x,y = 0,0  
8      s = win.getSize()      s = win.getSize()
9      pix = win.readPixels(0, 0, s.width, s.height)      if w==None: w = s.width
10      saveimage.save(filename, pix, s.width, s.height)      if h==None: h = s.height
11        pix = win.readPixels(x, y, w, h)
12        saveimage.save(filename, pix, w, h)
13    
14  def savesequence(win, filebase, vs1, vs2, n):  def savesequence(win, filebase, vs1, vs2, n, **args):
15      for frame in range(0, n+1):      for frame in range(0, n+1):
16          fract = frame / (n+0.0)          fract = frame / (n+0.0)
17          win.renderAnim(vs1, vs2, fract, 0, 1)          win.renderAnim(vs1, vs2, fract, 0, 1)
18          saveframe(filebase + "%03d"%frame + ".jpg", win)          saveframe(filebase + "%03d"%frame + ".jpg", win, **args)
19    
20  def encodefilm(globpat, outfilm):  def encodefilm(globpat, outfilm):
21      mencoder = "/BIG/MPlayer-0.90pre8/mencoder"      mencoder = "/BIG/MPlayer-0.90pre8/mencoder"
22      os.system("%(mencoder)s %(globpat)s -lavcopts vcodec=mpeg4 -mf on:fps=25 -ovc lavc -o %(outfilm)s"      cmd = "%(mencoder)s %(globpat)s -lavcopts vcodec=mpeg4 -mf on:fps=25 -ovc lavc -o %(outfilm)s" % locals()
23          % locals())      print cmd
24        os.system(cmd)
25    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26