CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/root/usr/share/doc/python-docs-2.6.6/html/library/
Upload File :
Current File : //proc/2/root/usr/share/doc/python-docs-2.6.6/html/library/imageop.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>21.2. imageop — Manipulate raw image data &mdash; Python v2.6.6 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.6',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.6 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.6 documentation" href="../index.html" />
    <link rel="up" title="21. Multimedia Services" href="mm.html" />
    <link rel="next" title="21.3. aifc — Read and write AIFF and AIFC files" href="aifc.html" />
    <link rel="prev" title="21.1. audioop — Manipulate raw audio data" href="audioop.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="aifc.html" title="21.3. aifc — Read and write AIFF and AIFC files"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="audioop.html" title="21.1. audioop — Manipulate raw audio data"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.6 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mm.html" accesskey="U">21. Multimedia Services</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-imageop">
<h1>21.2. <tt class="xref docutils literal"><span class="pre">imageop</span></tt> &#8212; Manipulate raw image data<a class="headerlink" href="#module-imageop" title="Permalink to this headline">¶</a></h1>
<p class="deprecated">
<span class="versionmodified">Deprecated since version 2.6: </span>The <tt class="xref docutils literal"><span class="pre">imageop</span></tt> module has been removed in Python 3.0.</p>
<p>The <tt class="xref docutils literal"><span class="pre">imageop</span></tt> module contains some useful operations on images. It operates
on images consisting of 8 or 32 bit pixels stored in Python strings.  This is
the same format as used by <tt class="xref docutils literal"><span class="pre">gl.lrectwrite()</span></tt> and the <a title="(IRIX) Support for SGI imglib files. (deprecated)" class="reference external" href="imgfile.html#module-imgfile"><tt class="xref docutils literal"><span class="pre">imgfile</span></tt></a> module.</p>
<p>The module defines the following variables and functions:</p>
<dl class="exception">
<dt id="imageop.error">
<em class="property">exception </em><tt class="descclassname">imageop.</tt><tt class="descname">error</tt><a class="headerlink" href="#imageop.error" title="Permalink to this definition">¶</a></dt>
<dd>This exception is raised on all errors, such as unknown number of bits per
pixel, etc.</dd></dl>

<dl class="function">
<dt id="imageop.crop">
<tt class="descclassname">imageop.</tt><tt class="descname">crop</tt><big>(</big><em>image</em>, <em>psize</em>, <em>width</em>, <em>height</em>, <em>x0</em>, <em>y0</em>, <em>x1</em>, <em>y1</em><big>)</big><a class="headerlink" href="#imageop.crop" title="Permalink to this definition">¶</a></dt>
<dd>Return the selected part of <em>image</em>, which should be <em>width</em> by <em>height</em> in size
and consist of pixels of <em>psize</em> bytes. <em>x0</em>, <em>y0</em>, <em>x1</em> and <em>y1</em> are like the
<tt class="xref docutils literal"><span class="pre">gl.lrectread()</span></tt> parameters, i.e. the boundary is included in the new image.
The new boundaries need not be inside the picture.  Pixels that fall outside the
old image will have their value set to zero.  If <em>x0</em> is bigger than <em>x1</em> the
new image is mirrored.  The same holds for the y coordinates.</dd></dl>

<dl class="function">
<dt id="imageop.scale">
<tt class="descclassname">imageop.</tt><tt class="descname">scale</tt><big>(</big><em>image</em>, <em>psize</em>, <em>width</em>, <em>height</em>, <em>newwidth</em>, <em>newheight</em><big>)</big><a class="headerlink" href="#imageop.scale" title="Permalink to this definition">¶</a></dt>
<dd>Return <em>image</em> scaled to size <em>newwidth</em> by <em>newheight</em>. No interpolation is
done, scaling is done by simple-minded pixel duplication or removal.  Therefore,
computer-generated images or dithered images will not look nice after scaling.</dd></dl>

<dl class="function">
<dt id="imageop.tovideo">
<tt class="descclassname">imageop.</tt><tt class="descname">tovideo</tt><big>(</big><em>image</em>, <em>psize</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.tovideo" title="Permalink to this definition">¶</a></dt>
<dd>Run a vertical low-pass filter over an image.  It does so by computing each
destination pixel as the average of two vertically-aligned source pixels.  The
main use of this routine is to forestall excessive flicker if the image is
displayed on a video device that uses interlacing, hence the name.</dd></dl>

<dl class="function">
<dt id="imageop.grey2mono">
<tt class="descclassname">imageop.</tt><tt class="descname">grey2mono</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em>, <em>threshold</em><big>)</big><a class="headerlink" href="#imageop.grey2mono" title="Permalink to this definition">¶</a></dt>
<dd>Convert a 8-bit deep greyscale image to a 1-bit deep image by thresholding all
the pixels.  The resulting image is tightly packed and is probably only useful
as an argument to <a title="imageop.mono2grey" class="reference internal" href="#imageop.mono2grey"><tt class="xref docutils literal"><span class="pre">mono2grey()</span></tt></a>.</dd></dl>

<dl class="function">
<dt id="imageop.dither2mono">
<tt class="descclassname">imageop.</tt><tt class="descname">dither2mono</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.dither2mono" title="Permalink to this definition">¶</a></dt>
<dd>Convert an 8-bit greyscale image to a 1-bit monochrome image using a
(simple-minded) dithering algorithm.</dd></dl>

<dl class="function">
<dt id="imageop.mono2grey">
<tt class="descclassname">imageop.</tt><tt class="descname">mono2grey</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em>, <em>p0</em>, <em>p1</em><big>)</big><a class="headerlink" href="#imageop.mono2grey" title="Permalink to this definition">¶</a></dt>
<dd>Convert a 1-bit monochrome image to an 8 bit greyscale or color image. All
pixels that are zero-valued on input get value <em>p0</em> on output and all one-value
input pixels get value <em>p1</em> on output.  To convert a monochrome black-and-white
image to greyscale pass the values <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">255</span></tt> respectively.</dd></dl>

<dl class="function">
<dt id="imageop.grey2grey4">
<tt class="descclassname">imageop.</tt><tt class="descname">grey2grey4</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.grey2grey4" title="Permalink to this definition">¶</a></dt>
<dd>Convert an 8-bit greyscale image to a 4-bit greyscale image without dithering.</dd></dl>

<dl class="function">
<dt id="imageop.grey2grey2">
<tt class="descclassname">imageop.</tt><tt class="descname">grey2grey2</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.grey2grey2" title="Permalink to this definition">¶</a></dt>
<dd>Convert an 8-bit greyscale image to a 2-bit greyscale image without dithering.</dd></dl>

<dl class="function">
<dt id="imageop.dither2grey2">
<tt class="descclassname">imageop.</tt><tt class="descname">dither2grey2</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.dither2grey2" title="Permalink to this definition">¶</a></dt>
<dd>Convert an 8-bit greyscale image to a 2-bit greyscale image with dithering.  As
for <a title="imageop.dither2mono" class="reference internal" href="#imageop.dither2mono"><tt class="xref docutils literal"><span class="pre">dither2mono()</span></tt></a>, the dithering algorithm is currently very simple.</dd></dl>

<dl class="function">
<dt id="imageop.grey42grey">
<tt class="descclassname">imageop.</tt><tt class="descname">grey42grey</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.grey42grey" title="Permalink to this definition">¶</a></dt>
<dd>Convert a 4-bit greyscale image to an 8-bit greyscale image.</dd></dl>

<dl class="function">
<dt id="imageop.grey22grey">
<tt class="descclassname">imageop.</tt><tt class="descname">grey22grey</tt><big>(</big><em>image</em>, <em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#imageop.grey22grey" title="Permalink to this definition">¶</a></dt>
<dd>Convert a 2-bit greyscale image to an 8-bit greyscale image.</dd></dl>

<dl class="data">
<dt id="imageop.backward_compatible">
<tt class="descclassname">imageop.</tt><tt class="descname">backward_compatible</tt><a class="headerlink" href="#imageop.backward_compatible" title="Permalink to this definition">¶</a></dt>
<dd>If set to 0, the functions in this module use a non-backward compatible way
of representing multi-byte pixels on little-endian systems.  The SGI for
which this module was originally written is a big-endian system, so setting
this variable will have no effect. However, the code wasn&#8217;t originally
intended to run on anything else, so it made assumptions about byte order
which are not universal.  Setting this variable to 0 will cause the byte
order to be reversed on little-endian systems, so that it then is the same as
on big-endian systems.</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h4>Previous topic</h4>
            <p class="topless"><a href="audioop.html"
                                  title="previous chapter">21.1. <tt class="docutils literal docutils literal"><span class="pre">audioop</span></tt> &#8212; Manipulate raw audio data</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="aifc.html"
                                  title="next chapter">21.3. <tt class="docutils literal docutils literal"><span class="pre">aifc</span></tt> &#8212; Read and write AIFF and AIFC files</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/imageop.txt"
         rel="nofollow">Show Source</a></li>
</ul>

          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="aifc.html" title="21.3. aifc — Read and write AIFF and AIFC files"
             >next</a> |</li>
        <li class="right" >
          <a href="audioop.html" title="21.1. audioop — Manipulate raw audio data"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.6 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mm.html" >21. Multimedia Services</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2011, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Jul 20, 2011.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6.
    </div>

  </body>
</html>

Copyright 2K16 - 2K18 Indonesian Hacker Rulez