• Home
  • Raw
  • Download

Lines Matching +full:greytest +full:. +full:rgb

1 """Simple test script for imgfile.c
2 Roger E. Masse
5 from test.test_support import verbose, unlink, findfile, import_module
13 on the image passed in name.
24 # of the image in pixels and z is the number of bytes per pixel. Only
25 # 3 byte RGB pixels and 1 byte greyscale pixels are supported.
26 sizes = imgfile.getsizes(name)
27 except imgfile.error:
28 # get a more qualified path component of the script...
30 ourname = sys.argv[0]
31 else: # ...or the full path of the module
32 ourname = sys.modules[__name__].__file__
34 parts = ourname.split(os.sep)
36 name = os.sep.join(parts)
37 sizes = imgfile.getsizes(name)
41 # and returns it as a python string. The string has either 1 byte
42 # greyscale pixels or 4 byte RGBA pixels. The bottom left pixel
43 # is the first in the string. This format is suitable to pass
44 # to gl.lrectwrite, for instance.
45 image = imgfile.read(name)
47 # This function writes the RGB or greyscale data in data to
48 # image file file. x and y give the size of the image, z is
49 # 1 for 1 byte greyscale images or 3 for RGB images (which
51 # bytes are used). These are the formats returned by gl.lrectread.
54 imgfile.write (outputfile, image, sizes[0], sizes[1], sizes[2])
60 # is scaled to the given x and y sizes. If the filter and blur
63 # especially for computer-generated images. Alternatively,
65 # scaling. The filter forms supported are 'impulse', 'box',
66 # 'triangle', 'quadratic' and 'gaussian'. If a filter is
68 # blurriness of the filter. It defaults to 1.0. readscaled
70 # is the users' responsibility.
73 simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'impulse', 2.0)
78 # bottom(flag is one, compatible with X). The default is zero.
81 imgfile.ttob (1)
85 simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'triangle', 3.0)
88 imgfile.ttob (0)
91 simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'quadratic')
93 simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'gaussian', 1.0)
97 imgfile.write (outputfile, simage, sizes[0]/2, sizes[1]/2, sizes[2])
99 os.unlink(outputfile)
104 uu.decode(findfile('testrgb.uue'), 'test.rgb')
105 uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
108 testimage('test.rgb')
111 testimage('greytest.rgb')
113 unlink('test.rgb')
114 unlink('greytest.rgb')