Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-jpeg.html" /> | |
13 | <link rel="prev" href="module-gl-constants.html" /> | |
14 | <link rel="parent" href="sgi.html" /> | |
15 | <link rel="next" href="module-jpeg.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>20.11 imgfile -- Support for SGI imglib files</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="20.10 GL " | |
25 | href="module-gl-constants.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="20. SGI IRIX Specific" | |
28 | href="sgi.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="20.12 jpeg " | |
31 | href="module-jpeg.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-gl-constants.html">20.10 GL </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="sgi.html">20. SGI IRIX Specific</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-jpeg.html">20.12 jpeg </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION00221100000000000000000"> | |
56 | 20.11 <tt class="module">imgfile</tt> -- | |
57 | Support for SGI imglib files</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-imgfile"></A> | |
62 | <p class="availability">Availability: <span | |
63 | class="platform">IRIX</span>.</p> | |
64 | ||
65 | <P> | |
66 | The <tt class="module">imgfile</tt> module allows Python programs to access SGI imglib image | |
67 | files (also known as <span class="file">.rgb</span> files). The module is far from | |
68 | complete, but is provided anyway since the functionality that there is | |
69 | enough in some cases. Currently, colormap files are not supported. | |
70 | ||
71 | <P> | |
72 | The module defines the following variables and functions: | |
73 | ||
74 | <P> | |
75 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-5207' xml:id='l2h-5207' class="exception">error</tt></b></dt> | |
76 | <dd> | |
77 | This exception is raised on all errors, such as unsupported file type, etc. | |
78 | </dd></dl> | |
79 | ||
80 | <P> | |
81 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
82 | <td><nobr><b><tt id='l2h-5208' xml:id='l2h-5208' class="function">getsizes</tt></b>(</nobr></td> | |
83 | <td><var>file</var>)</td></tr></table></dt> | |
84 | <dd> | |
85 | This function returns a tuple <code>(<var>x</var>, <var>y</var>, <var>z</var>)</code> where | |
86 | <var>x</var> and <var>y</var> are the size of the image in pixels and | |
87 | <var>z</var> is the number of | |
88 | bytes per pixel. Only 3 byte RGB pixels and 1 byte greyscale pixels | |
89 | are currently supported. | |
90 | </dl> | |
91 | ||
92 | <P> | |
93 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
94 | <td><nobr><b><tt id='l2h-5209' xml:id='l2h-5209' class="function">read</tt></b>(</nobr></td> | |
95 | <td><var>file</var>)</td></tr></table></dt> | |
96 | <dd> | |
97 | This function reads and decodes the image on the specified file, and | |
98 | returns it as a Python string. The string has either 1 byte greyscale | |
99 | pixels or 4 byte RGBA pixels. The bottom left pixel is the first in | |
100 | the string. This format is suitable to pass to <tt class="function">gl.lrectwrite()</tt>, | |
101 | for instance. | |
102 | </dl> | |
103 | ||
104 | <P> | |
105 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
106 | <td><nobr><b><tt id='l2h-5210' xml:id='l2h-5210' class="function">readscaled</tt></b>(</nobr></td> | |
107 | <td><var>file, x, y, filter</var><big>[</big><var>, blur</var><big>]</big><var></var>)</td></tr></table></dt> | |
108 | <dd> | |
109 | This function is identical to read but it returns an image that is | |
110 | scaled to the given <var>x</var> and <var>y</var> sizes. If the <var>filter</var> and | |
111 | <var>blur</var> parameters are omitted scaling is done by | |
112 | simply dropping or duplicating pixels, so the result will be less than | |
113 | perfect, especially for computer-generated images. | |
114 | ||
115 | <P> | |
116 | Alternatively, you can specify a filter to use to smooth the image | |
117 | after scaling. The filter forms supported are <code>'impulse'</code>, | |
118 | <code>'box'</code>, <code>'triangle'</code>, <code>'quadratic'</code> and | |
119 | <code>'gaussian'</code>. If a filter is specified <var>blur</var> is an optional | |
120 | parameter specifying the blurriness of the filter. It defaults to <code>1.0</code>. | |
121 | ||
122 | <P> | |
123 | <tt class="function">readscaled()</tt> makes no attempt to keep the aspect ratio | |
124 | correct, so that is the users' responsibility. | |
125 | </dl> | |
126 | ||
127 | <P> | |
128 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
129 | <td><nobr><b><tt id='l2h-5211' xml:id='l2h-5211' class="function">ttob</tt></b>(</nobr></td> | |
130 | <td><var>flag</var>)</td></tr></table></dt> | |
131 | <dd> | |
132 | This function sets a global flag which defines whether the scan lines | |
133 | of the image are read or written from bottom to top (flag is zero, | |
134 | compatible with SGI GL) or from top to bottom(flag is one, | |
135 | compatible with X). The default is zero. | |
136 | </dl> | |
137 | ||
138 | <P> | |
139 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
140 | <td><nobr><b><tt id='l2h-5212' xml:id='l2h-5212' class="function">write</tt></b>(</nobr></td> | |
141 | <td><var>file, data, x, y, z</var>)</td></tr></table></dt> | |
142 | <dd> | |
143 | This function writes the RGB or greyscale data in <var>data</var> to image | |
144 | file <var>file</var>. <var>x</var> and <var>y</var> give the size of the image, | |
145 | <var>z</var> is 1 for 1 byte greyscale images or 3 for RGB images (which are | |
146 | stored as 4 byte values of which only the lower three bytes are used). | |
147 | These are the formats returned by <tt class="function">gl.lrectread()</tt>. | |
148 | </dl> | |
149 | ||
150 | <DIV CLASS="navigation"> | |
151 | <div class='online-navigation'> | |
152 | <p></p><hr /> | |
153 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
154 | <tr> | |
155 | <td class='online-navigation'><a rel="prev" title="20.10 GL " | |
156 | href="module-gl-constants.html"><img src='../icons/previous.png' | |
157 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
158 | <td class='online-navigation'><a rel="parent" title="20. SGI IRIX Specific" | |
159 | href="sgi.html"><img src='../icons/up.png' | |
160 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
161 | <td class='online-navigation'><a rel="next" title="20.12 jpeg " | |
162 | href="module-jpeg.html"><img src='../icons/next.png' | |
163 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
164 | <td align="center" width="100%">Python Library Reference</td> | |
165 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
166 | href="contents.html"><img src='../icons/contents.png' | |
167 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
168 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
169 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
170 | <td class='online-navigation'><a rel="index" title="Index" | |
171 | href="genindex.html"><img src='../icons/index.png' | |
172 | border='0' height='32' alt='Index' width='32' /></A></td> | |
173 | </tr></table> | |
174 | <div class='online-navigation'> | |
175 | <b class="navlabel">Previous:</b> | |
176 | <a class="sectref" rel="prev" href="module-gl-constants.html">20.10 GL </A> | |
177 | <b class="navlabel">Up:</b> | |
178 | <a class="sectref" rel="parent" href="sgi.html">20. SGI IRIX Specific</A> | |
179 | <b class="navlabel">Next:</b> | |
180 | <a class="sectref" rel="next" href="module-jpeg.html">20.12 jpeg </A> | |
181 | </div> | |
182 | </div> | |
183 | <hr /> | |
184 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
185 | </DIV> | |
186 | <!--End of Navigation Panel--> | |
187 | <ADDRESS> | |
188 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
189 | </ADDRESS> | |
190 | </BODY> | |
191 | </HTML> |