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-imghdr.html" /> | |
13 | <link rel="prev" href="module-colorsys.html" /> | |
14 | <link rel="parent" href="mmedia.html" /> | |
15 | <link rel="next" href="module-imghdr.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>14.8 rgbimg -- Read and write ``SGI RGB'' 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="14.7 colorsys " | |
25 | href="module-colorsys.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="14. Multimedia Services" | |
28 | href="mmedia.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="14.9 imghdr " | |
31 | href="module-imghdr.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-colorsys.html">14.7 colorsys </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-imghdr.html">14.9 imghdr </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0016800000000000000000"> | |
56 | 14.8 <tt class="module">rgbimg</tt> -- | |
57 | Read and write ``SGI RGB'' files</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-rgbimg"></A> | |
62 | ||
63 | <P> | |
64 | The <tt class="module">rgbimg</tt> module allows Python programs to access SGI imglib image | |
65 | files (also known as <span class="file">.rgb</span> files). The module is far from | |
66 | complete, but is provided anyway since the functionality that there is | |
67 | enough in some cases. Currently, colormap files are not supported. | |
68 | ||
69 | <P> | |
70 | <span class="note"><b class="label">Note:</b> | |
71 | This module is only built by default for 32-bit platforms; it is | |
72 | not expected to work properly on other systems.</span> | |
73 | ||
74 | <P> | |
75 | The module defines the following variables and functions: | |
76 | ||
77 | <P> | |
78 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-4756' xml:id='l2h-4756' class="exception">error</tt></b></dt> | |
79 | <dd> | |
80 | This exception is raised on all errors, such as unsupported file type, etc. | |
81 | </dd></dl> | |
82 | ||
83 | <P> | |
84 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
85 | <td><nobr><b><tt id='l2h-4757' xml:id='l2h-4757' class="function">sizeofimage</tt></b>(</nobr></td> | |
86 | <td><var>file</var>)</td></tr></table></dt> | |
87 | <dd> | |
88 | This function returns a tuple <code>(<var>x</var>, <var>y</var>)</code> where | |
89 | <var>x</var> and <var>y</var> are the size of the image in pixels. | |
90 | Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels | |
91 | are currently supported. | |
92 | </dl> | |
93 | ||
94 | <P> | |
95 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
96 | <td><nobr><b><tt id='l2h-4758' xml:id='l2h-4758' class="function">longimagedata</tt></b>(</nobr></td> | |
97 | <td><var>file</var>)</td></tr></table></dt> | |
98 | <dd> | |
99 | This function reads and decodes the image on the specified file, and | |
100 | returns it as a Python string. The string has 4 byte RGBA pixels. | |
101 | The bottom left pixel is the first in | |
102 | the string. This format is suitable to pass to <tt class="function">gl.lrectwrite()</tt>, | |
103 | for instance. | |
104 | </dl> | |
105 | ||
106 | <P> | |
107 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
108 | <td><nobr><b><tt id='l2h-4759' xml:id='l2h-4759' class="function">longstoimage</tt></b>(</nobr></td> | |
109 | <td><var>data, x, y, z, file</var>)</td></tr></table></dt> | |
110 | <dd> | |
111 | This function writes the RGBA data in <var>data</var> to image | |
112 | file <var>file</var>. <var>x</var> and <var>y</var> give the size of the image. | |
113 | <var>z</var> is 1 if the saved image should be 1 byte greyscale, 3 if the | |
114 | saved image should be 3 byte RGB data, or 4 if the saved images should | |
115 | be 4 byte RGBA data. The input data always contains 4 bytes per pixel. | |
116 | These are the formats returned by <tt class="function">gl.lrectread()</tt>. | |
117 | </dl> | |
118 | ||
119 | <P> | |
120 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
121 | <td><nobr><b><tt id='l2h-4760' xml:id='l2h-4760' class="function">ttob</tt></b>(</nobr></td> | |
122 | <td><var>flag</var>)</td></tr></table></dt> | |
123 | <dd> | |
124 | This function sets a global flag which defines whether the scan lines | |
125 | of the image are read or written from bottom to top (flag is zero, | |
126 | compatible with SGI GL) or from top to bottom(flag is one, | |
127 | compatible with X). The default is zero. | |
128 | </dl> | |
129 | ||
130 | <DIV CLASS="navigation"> | |
131 | <div class='online-navigation'> | |
132 | <p></p><hr /> | |
133 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
134 | <tr> | |
135 | <td class='online-navigation'><a rel="prev" title="14.7 colorsys " | |
136 | href="module-colorsys.html"><img src='../icons/previous.png' | |
137 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
138 | <td class='online-navigation'><a rel="parent" title="14. Multimedia Services" | |
139 | href="mmedia.html"><img src='../icons/up.png' | |
140 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
141 | <td class='online-navigation'><a rel="next" title="14.9 imghdr " | |
142 | href="module-imghdr.html"><img src='../icons/next.png' | |
143 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
144 | <td align="center" width="100%">Python Library Reference</td> | |
145 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
146 | href="contents.html"><img src='../icons/contents.png' | |
147 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
148 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
149 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
150 | <td class='online-navigation'><a rel="index" title="Index" | |
151 | href="genindex.html"><img src='../icons/index.png' | |
152 | border='0' height='32' alt='Index' width='32' /></A></td> | |
153 | </tr></table> | |
154 | <div class='online-navigation'> | |
155 | <b class="navlabel">Previous:</b> | |
156 | <a class="sectref" rel="prev" href="module-colorsys.html">14.7 colorsys </A> | |
157 | <b class="navlabel">Up:</b> | |
158 | <a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A> | |
159 | <b class="navlabel">Next:</b> | |
160 | <a class="sectref" rel="next" href="module-imghdr.html">14.9 imghdr </A> | |
161 | </div> | |
162 | </div> | |
163 | <hr /> | |
164 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
165 | </DIV> | |
166 | <!--End of Navigation Panel--> | |
167 | <ADDRESS> | |
168 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
169 | </ADDRESS> | |
170 | </BODY> | |
171 | </HTML> |