Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / module-rgbimg.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-imghdr.html" />
<link rel="prev" href="module-colorsys.html" />
<link rel="parent" href="mmedia.html" />
<link rel="next" href="module-imghdr.html" />
<meta name='aesop' content='information' />
<title>14.8 rgbimg -- Read and write ``SGI RGB'' files</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.7 colorsys "
href="module-colorsys.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
href="mmedia.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="14.9 imghdr "
href="module-imghdr.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-colorsys.html">14.7 colorsys </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-imghdr.html">14.9 imghdr </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION0016800000000000000000">
14.8 <tt class="module">rgbimg</tt> --
Read and write ``SGI RGB'' files</A>
</H1>
<P>
<A NAME="module-rgbimg"></A>
<P>
The <tt class="module">rgbimg</tt> module allows Python programs to access SGI imglib image
files (also known as <span class="file">.rgb</span> files). The module is far from
complete, but is provided anyway since the functionality that there is
enough in some cases. Currently, colormap files are not supported.
<P>
<span class="note"><b class="label">Note:</b>
This module is only built by default for 32-bit platforms; it is
not expected to work properly on other systems.</span>
<P>
The module defines the following variables and functions:
<P>
<dl><dt><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-4756' xml:id='l2h-4756' class="exception">error</tt></b></dt>
<dd>
This exception is raised on all errors, such as unsupported file type, etc.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4757' xml:id='l2h-4757' class="function">sizeofimage</tt></b>(</nobr></td>
<td><var>file</var>)</td></tr></table></dt>
<dd>
This function returns a tuple <code>(<var>x</var>, <var>y</var>)</code> where
<var>x</var> and <var>y</var> are the size of the image in pixels.
Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
are currently supported.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4758' xml:id='l2h-4758' class="function">longimagedata</tt></b>(</nobr></td>
<td><var>file</var>)</td></tr></table></dt>
<dd>
This function reads and decodes the image on the specified file, and
returns it as a Python string. The string has 4 byte RGBA pixels.
The bottom left pixel is the first in
the string. This format is suitable to pass to <tt class="function">gl.lrectwrite()</tt>,
for instance.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4759' xml:id='l2h-4759' class="function">longstoimage</tt></b>(</nobr></td>
<td><var>data, x, y, z, file</var>)</td></tr></table></dt>
<dd>
This function writes the RGBA data in <var>data</var> to image
file <var>file</var>. <var>x</var> and <var>y</var> give the size of the image.
<var>z</var> is 1 if the saved image should be 1 byte greyscale, 3 if the
saved image should be 3 byte RGB data, or 4 if the saved images should
be 4 byte RGBA data. The input data always contains 4 bytes per pixel.
These are the formats returned by <tt class="function">gl.lrectread()</tt>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4760' xml:id='l2h-4760' class="function">ttob</tt></b>(</nobr></td>
<td><var>flag</var>)</td></tr></table></dt>
<dd>
This function sets a global flag which defines whether the scan lines
of the image are read or written from bottom to top (flag is zero,
compatible with SGI GL) or from top to bottom(flag is one,
compatible with X). The default is zero.
</dl>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.7 colorsys "
href="module-colorsys.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
href="mmedia.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="14.9 imghdr "
href="module-imghdr.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-colorsys.html">14.7 colorsys </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-imghdr.html">14.9 imghdr </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>