<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>5.3.0 — Pillow (PIL Fork) 5.4.1 documentation</title> <script type="text/javascript" src="../_static/js/modernizr.min.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></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> <script type="text/javascript" src="../_static/language_data.js"></script> <script type="text/javascript" src="../_static/js/script.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script> <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="5.2.0" href="5.2.0.html" /> <link rel="prev" title="5.4.0" href="5.4.0.html" /> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href="../index.html" class="icon icon-home"> Pillow (PIL Fork) </a> <div class="version"> 5.4.1 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="../handbook/index.html">Handbook</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference/index.html">Reference</a></li> <li class="toctree-l1"><a class="reference internal" href="../porting.html">Porting</a></li> <li class="toctree-l1"><a class="reference internal" href="../about.html">About</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Release Notes</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="5.4.1.html">5.4.1</a></li> <li class="toctree-l2"><a class="reference internal" href="5.4.0.html">5.4.0</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">5.3.0</a><ul> <li class="toctree-l3"><a class="reference internal" href="#api-changes">API Changes</a><ul> <li class="toctree-l4"><a class="reference internal" href="#image-size">Image size</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#api-additions">API Additions</a><ul> <li class="toctree-l4"><a class="reference internal" href="#added-line-width-parameter-to-rectangle-and-ellipse-based-shapes">Added line width parameter to rectangle and ellipse-based shapes</a></li> <li class="toctree-l4"><a class="reference internal" href="#curved-joints-for-line-sequences">Curved joints for line sequences</a></li> <li class="toctree-l4"><a class="reference internal" href="#imageops-colorize">ImageOps.colorize</a></li> <li class="toctree-l4"><a class="reference internal" href="#imageops-pad">ImageOps.pad</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#other-changes">Other Changes</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="5.2.0.html">5.2.0</a></li> <li class="toctree-l2"><a class="reference internal" href="5.1.0.html">5.1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="5.0.0.html">5.0.0</a></li> <li class="toctree-l2"><a class="reference internal" href="4.3.0.html">4.3.0</a></li> <li class="toctree-l2"><a class="reference internal" href="4.2.1.html">4.2.1</a></li> <li class="toctree-l2"><a class="reference internal" href="4.2.0.html">4.2.0</a></li> <li class="toctree-l2"><a class="reference internal" href="4.1.1.html">4.1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="4.1.0.html">4.1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="4.0.0.html">4.0.0</a></li> <li class="toctree-l2"><a class="reference internal" href="3.4.0.html">3.4.0</a></li> <li class="toctree-l2"><a class="reference internal" href="3.3.2.html">3.3.2</a></li> <li class="toctree-l2"><a class="reference internal" href="3.3.0.html">3.3.0</a></li> <li class="toctree-l2"><a class="reference internal" href="3.2.0.html">3.2.0</a></li> <li class="toctree-l2"><a class="reference internal" href="3.1.2.html">3.1.2</a></li> <li class="toctree-l2"><a class="reference internal" href="3.1.1.html">3.1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="3.1.0.html">3.1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="3.0.0.html">3.0.0</a></li> <li class="toctree-l2"><a class="reference internal" href="2.8.0.html">2.8.0</a></li> <li class="toctree-l2"><a class="reference internal" href="2.7.0.html">2.7.0</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../deprecations.html">Deprecations and removals</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">Pillow (PIL Fork)</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html">Docs</a> »</li> <li><a href="index.html">Release Notes</a> »</li> <li>5.3.0</li> <li class="wy-breadcrumbs-aside"> <a href="../_sources/releasenotes/5.3.0.rst.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="id1"> <h1>5.3.0<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1> <div class="section" id="api-changes"> <h2>API Changes<a class="headerlink" href="#api-changes" title="Permalink to this headline">¶</a></h2> <div class="section" id="image-size"> <h3>Image size<a class="headerlink" href="#image-size" title="Permalink to this headline">¶</a></h3> <p>If you attempt to set the size of an image directly, e.g. <code class="docutils literal notranslate"><span class="pre">im.size</span> <span class="pre">=</span> <span class="pre">(100,</span> <span class="pre">100)</span></code>, you will now receive an <code class="docutils literal notranslate"><span class="pre">AttributeError</span></code>. This is not about removing existing functionality, but instead about raising an explicit error to prevent later consequences. The <code class="docutils literal notranslate"><span class="pre">resize</span></code> method is the correct way to change an image’s size.</p> <p>The exceptions to this are:</p> <ul class="simple"> <li>The ICO and ICNS image formats, which use <code class="docutils literal notranslate"><span class="pre">im.size</span> <span class="pre">=</span> <span class="pre">(100,</span> <span class="pre">100)</span></code> to select a subimage.</li> <li>The TIFF image format, which now has a <code class="docutils literal notranslate"><span class="pre">DeprecationWarning</span></code> for this action, as direct image size setting was previously necessary to work around an issue with tile extents.</li> </ul> </div> </div> <div class="section" id="api-additions"> <h2>API Additions<a class="headerlink" href="#api-additions" title="Permalink to this headline">¶</a></h2> <div class="section" id="added-line-width-parameter-to-rectangle-and-ellipse-based-shapes"> <h3>Added line width parameter to rectangle and ellipse-based shapes<a class="headerlink" href="#added-line-width-parameter-to-rectangle-and-ellipse-based-shapes" title="Permalink to this headline">¶</a></h3> <p>An optional line <code class="docutils literal notranslate"><span class="pre">width</span></code> parameter has been added to <code class="docutils literal notranslate"><span class="pre">ImageDraw.Draw.arc</span></code>, <code class="docutils literal notranslate"><span class="pre">chord</span></code>, <code class="docutils literal notranslate"><span class="pre">ellipse</span></code>, <code class="docutils literal notranslate"><span class="pre">pieslice</span></code> and <code class="docutils literal notranslate"><span class="pre">rectangle</span></code>.</p> </div> <div class="section" id="curved-joints-for-line-sequences"> <h3>Curved joints for line sequences<a class="headerlink" href="#curved-joints-for-line-sequences" title="Permalink to this headline">¶</a></h3> <p><code class="docutils literal notranslate"><span class="pre">ImageDraw.Draw.line</span></code> draws a line, or lines, between points. Previously, when multiple points are given, for a larger <code class="docutils literal notranslate"><span class="pre">width</span></code>, the joints between these lines looked unsightly. There is now an additional optional argument, <code class="docutils literal notranslate"><span class="pre">joint</span></code>, defaulting to <code class="docutils literal notranslate"><span class="pre">None</span></code>. When it is set to <code class="docutils literal notranslate"><span class="pre">curved</span></code>, the joints between the lines will become rounded.</p> </div> <div class="section" id="imageops-colorize"> <h3>ImageOps.colorize<a class="headerlink" href="#imageops-colorize" title="Permalink to this headline">¶</a></h3> <p>Previously <code class="docutils literal notranslate"><span class="pre">ImageOps.colorize</span></code> only supported two-color mapping with <code class="docutils literal notranslate"><span class="pre">black</span></code> and <code class="docutils literal notranslate"><span class="pre">white</span></code> arguments being mapped to 0 and 255 respectively. Now it supports three-color mapping with the optional <code class="docutils literal notranslate"><span class="pre">mid</span></code> parameter, and the positions for all three color arguments can each be optionally specified (<code class="docutils literal notranslate"><span class="pre">blackpoint</span></code>, <code class="docutils literal notranslate"><span class="pre">whitepoint</span></code> and <code class="docutils literal notranslate"><span class="pre">midpoint</span></code>). For example, with all optional arguments:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ImageOps</span><span class="o">.</span><span class="n">colorize</span><span class="p">(</span><span class="n">im</span><span class="p">,</span> <span class="n">black</span><span class="o">=</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="mi">37</span><span class="p">,</span> <span class="mi">79</span><span class="p">),</span> <span class="n">white</span><span class="o">=</span><span class="s1">'white'</span><span class="p">,</span> <span class="n">mid</span><span class="o">=</span><span class="p">(</span><span class="mi">59</span><span class="p">,</span> <span class="mi">101</span><span class="p">,</span> <span class="mi">175</span><span class="p">),</span> <span class="n">blackpoint</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span> <span class="n">whitepoint</span><span class="o">=</span><span class="mi">240</span><span class="p">,</span> <span class="n">midpoint</span><span class="o">=</span><span class="mi">100</span><span class="p">)</span> </pre></div> </div> </div> <div class="section" id="imageops-pad"> <h3>ImageOps.pad<a class="headerlink" href="#imageops-pad" title="Permalink to this headline">¶</a></h3> <p>While <code class="docutils literal notranslate"><span class="pre">ImageOps.fit</span></code> allows users to crop images to a requested aspect ratio and size, new method <code class="docutils literal notranslate"><span class="pre">ImageOps.pad</span></code> pads images to fill a requested aspect ratio and size, filling new space with a provided <code class="docutils literal notranslate"><span class="pre">color</span></code> and positioning the image within the new area through a <code class="docutils literal notranslate"><span class="pre">centering</span></code> argument.</p> </div> </div> <div class="section" id="other-changes"> <h2>Other Changes<a class="headerlink" href="#other-changes" title="Permalink to this headline">¶</a></h2> <p>Added support for reading tiled TIFF images through LibTIFF. Compressed TIFF images are now read through LibTIFF.</p> <p>RGB WebP images are now read as RGB mode, rather than RGBX.</p> </div> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="5.2.0.html" class="btn btn-neutral float-right" title="5.2.0" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="5.4.0.html" class="btn btn-neutral float-left" title="5.4.0" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 1995-2011 Fredrik Lundh, 2010-2018 Alex Clark and Contributors </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>