diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1993-01-27 11:40:16 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1993-01-27 11:40:16 (GMT) |
commit | 62fda0acbddec92fbc6fceaef657f227ca120a9b (patch) | |
tree | 96e2e6215c05fae36ada2c775df06fbeecc416da /Demo/sgi/video/rgb2video.py | |
parent | e6f49ecfa908c747ca976749fee6a047e3f1b1ad (diff) | |
download | cpython-62fda0acbddec92fbc6fceaef657f227ca120a9b.zip cpython-62fda0acbddec92fbc6fceaef657f227ca120a9b.tar.gz cpython-62fda0acbddec92fbc6fceaef657f227ca120a9b.tar.bz2 |
Use imgconv to try to do image type conversion
Diffstat (limited to 'Demo/sgi/video/rgb2video.py')
-rwxr-xr-x | Demo/sgi/video/rgb2video.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Demo/sgi/video/rgb2video.py b/Demo/sgi/video/rgb2video.py index 040c1e5..c6dd685 100755 --- a/Demo/sgi/video/rgb2video.py +++ b/Demo/sgi/video/rgb2video.py @@ -3,6 +3,7 @@ import VFile import getopt import imgfile import string +import imgconv def main(): format = None @@ -31,18 +32,21 @@ def main(): xsize, ysize, zsize = imgfile.getsizes(args[0]) nxsize = xsize - if not format: - if zsize == 3: - format = 'rgb' - elif zsize == 1: - format = 'grey' - if xsize % 4: - addbytes = 4-(xsize%4) - nxsize = xsize + addbytes - print 'rgb2video: add',addbytes,'pixels per line' - else: - print 'rgb2video: incorrect number of planes:',zsize - sys.exit(1) + if zsize == 3: + oformat = 'rgb' + elif zsize == 1: + oformat = 'grey' + if xsize % 4: + addbytes = 4-(xsize%4) + nxsize = xsize + addbytes + print 'rgb2video: add',addbytes,'pixels per line' + else: + print 'rgb2video: incorrect number of planes:',zsize + sys.exit(1) + + if format == None: + format = oformat + cfunc = imgconv.getconverter(oformat, format) vout = VFile.VoutFile().init(outfile) vout.format = format @@ -63,7 +67,7 @@ def main(): curline = data[i:i+xsize] ndata = ndata + curline + ('\0'*(nxsize-xsize)) data = ndata - vout.writeframe(t, data, None) + vout.writeframe(t, cfunc(data, nxsize, ysize), None) t = t + interval sys.stderr.write('\n') vout.close() |