Sophie

Sophie

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

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>Concepts &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="Guides" href="../guides.html" />
    <link rel="next" title="Porting existing PIL-based code to Pillow" href="../porting-pil-to-pillow.html" />
    <link rel="prev" title="Tutorial" href="tutorial.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="../porting-pil-to-pillow.html" title="Porting existing PIL-based code to Pillow"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="tutorial.html" title="Tutorial"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Home</a> &raquo;</li>
          <li><a href="../guides.html" accesskey="U">Guides</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="concepts">
<h1>Concepts<a class="headerlink" href="#concepts" title="Permalink to this headline">¶</a></h1>
<p>The Python Imaging Library handles <em>raster images</em>; that is, rectangles of
pixel data.</p>
<div class="section" id="bands">
<h2>Bands<a class="headerlink" href="#bands" title="Permalink to this headline">¶</a></h2>
<p>An image can consist of one or more bands of data. The Python Imaging Library
allows you to store several bands in a single image, provided they all have the
same dimensions and depth.</p>
<p>To get the number and names of bands in an image, use the
<tt class="xref py py-meth docutils literal"><span class="pre">getbands()</span></tt> method.</p>
</div>
<div class="section" id="mode">
<h2>Mode<a class="headerlink" href="#mode" title="Permalink to this headline">¶</a></h2>
<p>The <em class="xref std std-term">mode</em> of an image defines the type and depth of a pixel in the
image. The current release supports the following standard modes:</p>
<blockquote>
<div><ul class="simple">
<li><tt class="docutils literal"><span class="pre">1</span></tt> (1-bit pixels, black and white, stored with one pixel per byte)</li>
<li><tt class="docutils literal"><span class="pre">L</span></tt> (8-bit pixels, black and white)</li>
<li><tt class="docutils literal"><span class="pre">P</span></tt> (8-bit pixels, mapped to any other mode using a color palette)</li>
<li><tt class="docutils literal"><span class="pre">RGB</span></tt> (3x8-bit pixels, true color)</li>
<li><tt class="docutils literal"><span class="pre">RGBA</span></tt> (4x8-bit pixels, true color with transparency mask)</li>
<li><tt class="docutils literal"><span class="pre">CMYK</span></tt> (4x8-bit pixels, color separation)</li>
<li><tt class="docutils literal"><span class="pre">YCbCr</span></tt> (3x8-bit pixels, color video format)</li>
<li><tt class="docutils literal"><span class="pre">LAB</span></tt> (3x8-bit pixels, the L*a*b color space)</li>
<li><tt class="docutils literal"><span class="pre">HSV</span></tt> (3x8-bit pixels, Hue, Saturation, Value color space)</li>
<li><tt class="docutils literal"><span class="pre">I</span></tt> (32-bit signed integer pixels)</li>
<li><tt class="docutils literal"><span class="pre">F</span></tt> (32-bit floating point pixels)</li>
</ul>
</div></blockquote>
<p>PIL also provides limited support for a few special modes, including <tt class="docutils literal"><span class="pre">LA</span></tt> (L
with alpha), <tt class="docutils literal"><span class="pre">RGBX</span></tt> (true color with padding) and <tt class="docutils literal"><span class="pre">RGBa</span></tt> (true color with
premultiplied alpha). However, PIL doesn’t support user-defined modes; if you
to handle band combinations that are not listed above, use a sequence of Image
objects.</p>
<p>You can read the mode of an image through the <tt class="xref py py-attr docutils literal"><span class="pre">mode</span></tt>
attribute. This is a string containing one of the above values.</p>
</div>
<div class="section" id="size">
<h2>Size<a class="headerlink" href="#size" title="Permalink to this headline">¶</a></h2>
<p>You can read the image size through the <tt class="xref py py-attr docutils literal"><span class="pre">size</span></tt>
attribute. This is a 2-tuple, containing the horizontal and vertical size in
pixels.</p>
</div>
<div class="section" id="coordinate-system">
<h2>Coordinate System<a class="headerlink" href="#coordinate-system" title="Permalink to this headline">¶</a></h2>
<p>The Python Imaging Library uses a Cartesian pixel coordinate system, with (0,0)
in the upper left corner. Note that the coordinates refer to the implied pixel
corners; the centre of a pixel addressed as (0, 0) actually lies at (0.5, 0.5).</p>
<p>Coordinates are usually passed to the library as 2-tuples (x, y). Rectangles
are represented as 4-tuples, with the upper left corner given first. For
example, a rectangle covering all of an 800x600 pixel image is written as (0,
0, 800, 600).</p>
</div>
<div class="section" id="palette">
<h2>Palette<a class="headerlink" href="#palette" title="Permalink to this headline">¶</a></h2>
<p>The palette mode (<tt class="docutils literal"><span class="pre">P</span></tt>) uses a color palette to define the actual color for
each pixel.</p>
</div>
<div class="section" id="info">
<h2>Info<a class="headerlink" href="#info" title="Permalink to this headline">¶</a></h2>
<p>You can attach auxiliary information to an image using the
<tt class="xref py py-attr docutils literal"><span class="pre">info</span></tt> attribute. This is a dictionary object.</p>
<p>How such information is handled when loading and saving image files is up to
the file format handler (see the chapter on <a class="reference internal" href="image-file-formats.html#image-file-formats"><em>Image file formats</em></a>). Most
handlers add properties to the <tt class="xref py py-attr docutils literal"><span class="pre">info</span></tt> attribute when
loading an image, but ignore it when saving images.</p>
</div>
<div class="section" id="filters">
<h2>Filters<a class="headerlink" href="#filters" title="Permalink to this headline">¶</a></h2>
<p>For geometry operations that may map multiple input pixels to a single output
pixel, the Python Imaging Library provides four different resampling <em>filters</em>.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">NEAREST</span></tt></dt>
<dd>Pick the nearest pixel from the input image. Ignore all other input pixels.</dd>
<dt><tt class="docutils literal"><span class="pre">BILINEAR</span></tt></dt>
<dd>Use linear interpolation over a 2x2 environment in the input image. Note
that in the current version of PIL, this filter uses a fixed input
environment when downsampling.</dd>
<dt><tt class="docutils literal"><span class="pre">BICUBIC</span></tt></dt>
<dd>Use cubic interpolation over a 4x4 environment in the input image. Note
that in the current version of PIL, this filter uses a fixed input
environment when downsampling.</dd>
<dt><tt class="docutils literal"><span class="pre">ANTIALIAS</span></tt></dt>
<dd><p class="first">Calculate the output pixel value using a high-quality resampling filter (a
truncated sinc) on all pixels that may contribute to the output value. In
the current version of PIL, this filter can only be used with the resize
and thumbnail methods.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 1.1.3.</span></p>
</div>
</dd>
</dl>
<p>Note that in the current version of PIL, the <tt class="docutils literal"><span class="pre">ANTIALIAS</span></tt> filter is the only
filter that behaves properly when downsampling (that is, when converting a
large image to a small one). The <tt class="docutils literal"><span class="pre">BILINEAR</span></tt> and <tt class="docutils literal"><span class="pre">BICUBIC</span></tt> filters use a
fixed input environment, and are best used for scale-preserving geometric
transforms and upsamping.</p>
</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="#">Concepts</a><ul>
<li><a class="reference internal" href="#bands">Bands</a></li>
<li><a class="reference internal" href="#mode">Mode</a></li>
<li><a class="reference internal" href="#size">Size</a></li>
<li><a class="reference internal" href="#coordinate-system">Coordinate System</a></li>
<li><a class="reference internal" href="#palette">Palette</a></li>
<li><a class="reference internal" href="#info">Info</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/handbook/concepts.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="../porting-pil-to-pillow.html" title="Porting existing PIL-based code to Pillow"
             >next</a> |</li>
        <li class="right" >
          <a href="tutorial.html" title="Tutorial"
             >previous</a> |</li>
        <li><a href="../index.html">Home</a> &raquo;</li>
          <li><a href="../guides.html" >Guides</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>