Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > b17ed897c34853a0a39ef25ab5d3af32 > files > 124

python3-pillow-doc-2.6.2-2.mga5.noarch.rpm

<!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>ImageFilter Module &mdash; Pillow v2.6.2 (PIL fork)</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.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="top" title="Pillow v2.6.2 (PIL fork)" href="../index.html" />
    <link rel="up" title="Reference" href="index.html" />
    <link rel="next" title="ImageFont Module" href="ImageFont.html" />
    <link rel="prev" title="ImageFile Module" href="ImageFile.html" /> 
  </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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="ImageFont.html" title="ImageFont Module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ImageFile.html" title="ImageFile Module"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Home</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">Reference</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-PIL.ImageFilter"></span><div class="section" id="imagefilter-module">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">ImageFilter</span></tt> Module<a class="headerlink" href="#imagefilter-module" title="Permalink to this headline">¶</a></h1>
<p>The <tt class="xref py py-mod docutils literal"><span class="pre">ImageFilter</span></tt> module contains definitions for a pre-defined set of
filters, which can be be used with the <tt class="xref py py-meth docutils literal"><span class="pre">Image.filter()</span></tt> method.</p>
<div class="section" id="example-filter-an-image">
<h2>Example: Filter an image<a class="headerlink" href="#example-filter-an-image" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PIL</span> <span class="kn">import</span> <span class="n">ImageFilter</span>

<span class="n">im1</span> <span class="o">=</span> <span class="n">im</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">ImageFilter</span><span class="o">.</span><span class="n">BLUR</span><span class="p">)</span>

<span class="n">im2</span> <span class="o">=</span> <span class="n">im</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">ImageFilter</span><span class="o">.</span><span class="n">MinFilter</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="n">im3</span> <span class="o">=</span> <span class="n">im</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">ImageFilter</span><span class="o">.</span><span class="n">MinFilter</span><span class="p">)</span>  <span class="c"># same as MinFilter(3)</span>
</pre></div>
</div>
</div>
<div class="section" id="filters">
<h2>Filters<a class="headerlink" href="#filters" title="Permalink to this headline">¶</a></h2>
<p>The current version of the library provides the following set of predefined
image enhancement filters:</p>
<ul class="simple">
<li><strong>BLUR</strong></li>
<li><strong>CONTOUR</strong></li>
<li><strong>DETAIL</strong></li>
<li><strong>EDGE_ENHANCE</strong></li>
<li><strong>EDGE_ENHANCE_MORE</strong></li>
<li><strong>EMBOSS</strong></li>
<li><strong>FIND_EDGES</strong></li>
<li><strong>SMOOTH</strong></li>
<li><strong>SMOOTH_MORE</strong></li>
<li><strong>SHARPEN</strong></li>
</ul>
<dl class="class">
<dt id="PIL.ImageFilter.GaussianBlur">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">GaussianBlur</tt><big>(</big><em>radius=2</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#GaussianBlur"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.GaussianBlur" title="Permalink to this definition">¶</a></dt>
<dd><p>Gaussian blur filter.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>radius</strong> &#8211; Blur radius.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.UnsharpMask">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">UnsharpMask</tt><big>(</big><em>radius=2</em>, <em>percent=150</em>, <em>threshold=3</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#UnsharpMask"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.UnsharpMask" title="Permalink to this definition">¶</a></dt>
<dd><p>Unsharp mask filter.</p>
<p>See Wikipedia&#8217;s entry on <a class="reference internal" href="#digital-unsharp-masking">digital unsharp masking</a> for an explanation of
the parameters.</p>
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking">https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking</a></p>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.Kernel">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">Kernel</tt><big>(</big><em>size</em>, <em>kernel</em>, <em>scale=None</em>, <em>offset=0</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#Kernel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.Kernel" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a convolution kernel.  The current version only
supports 3x3 and 5x5 integer and floating point kernels.</p>
<p>In the current version, kernels can only be applied to
&#8220;L&#8221; and &#8220;RGB&#8221; images.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>size</strong> &#8211; Kernel size, given as (width, height). In the current
version, this must be (3,3) or (5,5).</li>
<li><strong>kernel</strong> &#8211; A sequence containing kernel weights.</li>
<li><strong>scale</strong> &#8211; Scale factor. If given, the result for each pixel is
divided by this value.  the default is the sum of the
kernel weights.</li>
<li><strong>offset</strong> &#8211; Offset. If given, this value is added to the result,
after it has been divided by the scale factor.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.RankFilter">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">RankFilter</tt><big>(</big><em>size</em>, <em>rank</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#RankFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.RankFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a rank filter.  The rank filter sorts all pixels in
a window of the given size, and returns the <strong>rank</strong>&#8216;th value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>size</strong> &#8211; The kernel size, in pixels.</li>
<li><strong>rank</strong> &#8211; What pixel value to pick.  Use 0 for a min filter,
<tt class="docutils literal"><span class="pre">size</span> <span class="pre">*</span> <span class="pre">size</span> <span class="pre">/</span> <span class="pre">2</span></tt> for a median filter, <tt class="docutils literal"><span class="pre">size</span> <span class="pre">*</span> <span class="pre">size</span> <span class="pre">-</span> <span class="pre">1</span></tt>
for a max filter, etc.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.MedianFilter">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">MedianFilter</tt><big>(</big><em>size=3</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#MedianFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.MedianFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a median filter. Picks the median pixel value in a window with the
given size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> &#8211; The kernel size, in pixels.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.MinFilter">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">MinFilter</tt><big>(</big><em>size=3</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#MinFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.MinFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a min filter.  Picks the lowest pixel value in a window with the
given size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> &#8211; The kernel size, in pixels.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.MaxFilter">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">MaxFilter</tt><big>(</big><em>size=3</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#MaxFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.MaxFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a max filter.  Picks the largest pixel value in a window with the
given size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> &#8211; The kernel size, in pixels.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="PIL.ImageFilter.ModeFilter">
<em class="property">class </em><tt class="descclassname">PIL.ImageFilter.</tt><tt class="descname">ModeFilter</tt><big>(</big><em>size=3</em><big>)</big><a class="reference internal" href="../_modules/PIL/ImageFilter.html#ModeFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#PIL.ImageFilter.ModeFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a mode filter. Picks the most frequent pixel value in a box with the
given size.  Pixel values that occur only once or twice are ignored; if no
pixel value occurs more than twice, the original pixel value is preserved.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> &#8211; The kernel size, in pixels.</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">ImageFilter</span></tt> Module</a><ul>
<li><a class="reference internal" href="#example-filter-an-image">Example: Filter an image</a></li>
<li><a class="reference internal" href="#filters">Filters</a></li>
</ul>
</li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/reference/ImageFilter.txt"
           rel="nofollow">Show Source</a></li>
  </ul><h3>Need help?</h3>
<p>
    You can get help via IRC at <a href="irc://irc.freenode.net#pil">irc://irc.freenode.net#pil</a> or Stack Overflow <a href="http://stackoverflow.com/questions/tagged/pillow">here</a> and <a href="http://stackoverflow.com/questions/tagged/pil">here</a>. Please <a href="https://github.com/python-pillow/Pillow/issues/new">report issues on GitHub</a>.
</p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="ImageFont.html" title="ImageFont Module"
             >next</a> |</li>
        <li class="right" >
          <a href="ImageFile.html" title="ImageFile Module"
             >previous</a> |</li>
        <li><a href="../index.html">Home</a> &raquo;</li>
          <li><a href="index.html" >Reference</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 1997-2011 by Secret Labs AB, 1995-2011 by Fredrik Lundh, 2010-2013 Alex Clark.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>