<!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>pil — Phatch v0.2 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: '0.2', 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="top" title="Phatch v0.2 documentation" href="index.html" /> <link rel="up" title="core" href="core.html" /> <link rel="next" title="preview" href="core.preview.html" /> <link rel="prev" title="models" href="core.models.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="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li> <li class="right" > <a href="core.preview.html" title="preview" accesskey="N">next</a> |</li> <li class="right" > <a href="core.models.html" title="models" accesskey="P">previous</a> |</li> <li><a href="index.html">Phatch v0.2 documentation</a> »</li> <li><a href="core.html" accesskey="U">core</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-core.pil"> <h1>pil<a class="headerlink" href="#module-core.pil" title="Permalink to this headline">¶</a></h1> <p>All PIL related issues.</p> <dl class="class"> <dt id="core.pil.InfoPhoto"> <em class="property"> class </em><tt class="descclassname">core.pil.</tt><tt class="descname">InfoPhoto</tt><big>(</big><em>info</em>, <em>info_to_dump</em>, <em>get_pil</em>, <em>image=None</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref docutils literal"><span class="pre">dict</span></tt></p> <dl class="method"> <dt id="core.pil.InfoPhoto.assert_transparency"> <tt class="descname">assert_transparency</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.assert_transparency" title="Permalink to this definition">¶</a></dt> <dd>Raise a <tt class="docutils literal"><span class="pre">KeyError</span></tt> for <tt class="docutils literal"><span class="pre">'transparency'</span></tt> when <tt class="docutils literal"><span class="pre">image.mode</span></tt> is not <tt class="docutils literal"><span class="pre">'P'</span></tt>.</dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.assert_writable"> <tt class="descname">assert_writable</tt><big>(</big><em>tag</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.assert_writable" title="Permalink to this definition">¶</a></dt> <dd><p>Assert that the tag is writable. This can raise an <tt class="docutils literal"><span class="pre">NotWritableTagError</span></tt> because of several reasons:</p> <ul class="simple"> <li>Tag might be read-only (e.g. Exif_Photo_PixelXDimension)</li> <li>Tag might be not Exif or Iptc</li> <li>Image file format might not allow writing of this tag</li> </ul> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>tag</em> (string) – tag name</td> </tr> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">True, if writable</td> </tr> <tr class="field"><th class="field-name">Return type:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.clear_log"> <tt class="descname">clear_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.clear_log" title="Permalink to this definition">¶</a></dt> <dd>Clears the log.</dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.close"> <tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.close" title="Permalink to this definition">¶</a></dt> <dd>Remove circular reference.</dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.get_log"> <tt class="descname">get_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.get_log" title="Permalink to this definition">¶</a></dt> <dd><p>Get the log contents.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the log</td> </tr> <tr class="field"><th class="field-name">Return type:</th><td class="field-body">string</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.is_dirty"> <tt class="descname">is_dirty</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.is_dirty" title="Permalink to this definition">¶</a></dt> <dd><p>The photo can become dirty in two ways:</p> <ul class="simple"> <li>new metadata has been set</li> <li>the image has changes size</li> </ul> <p>In case the image size has changed it will update the <tt class="docutils literal"><span class="pre">Exif.Photo.PixelXDimension</span></tt> and <tt class="docutils literal"><span class="pre">Exif.Photo.PixelYimension</span></tt> accordingly.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">True, if dirty</td> </tr> <tr class="field"><th class="field-name">Return type:</th><td class="field-body">boolean</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.log"> <tt class="descname">log</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.log" title="Permalink to this definition">¶</a></dt> <dd><p>Log a message</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>message</em> (string) – message</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.save"> <tt class="descname">save</tt><big>(</big><em>target</em>, <em>target_format=None</em>, <em>thumbdata=None</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.save" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><em>target</em> (string) – target filename</li> <li><em>target_format</em> (string) – target format e.g. obtained by PIL</li> <li><em>thumbdata</em> (string) – new thumbnail (eg with StringIO, see <tt class="xref docutils literal"><span class="pre">imtools</span></tt>)</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.set"> <tt class="descname">set</tt><big>(</big><em>tag</em>, <em>value</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.set" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.update"> <tt class="descname">update</tt><big>(</big><em>d</em>, <em>explicit=True</em><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.update" title="Permalink to this definition">¶</a></dt> <dd>Do this explicitly so __setitem__ gets called.</dd></dl> <dl class="method"> <dt id="core.pil.InfoPhoto.update_size"> <tt class="descname">update_size</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.InfoPhoto.update_size" title="Permalink to this definition">¶</a></dt> <dd>If the image is exif writable and if the size has changed, it will update <tt class="docutils literal"><span class="pre">Exif.Photo.PixelXDimension</span></tt> and <tt class="docutils literal"><span class="pre">Exif.Photo.PixelYimension</span></tt>.</dd></dl> </dd></dl> <dl class="class"> <dt id="core.pil.Layer"> <em class="property"> class </em><tt class="descclassname">core.pil.</tt><tt class="descname">Layer</tt><big>(</big><em>filename</em>, <em>position=(0</em>, <em>0)</em>, <em>load=True</em><big>)</big><a class="headerlink" href="#core.pil.Layer" title="Permalink to this definition">¶</a></dt> <dd><dl class="method"> <dt id="core.pil.Layer.apply_pil"> <tt class="descname">apply_pil</tt><big>(</big><em>function</em>, <em>*arg</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Layer.apply_pil" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Layer.open"> <tt class="descname">open</tt><big>(</big><em>uri</em><big>)</big><a class="headerlink" href="#core.pil.Layer.open" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="exception"> <dt id="core.pil.NotWritableTagError"> <em class="property"> exception </em><tt class="descclassname">core.pil.</tt><tt class="descname">NotWritableTagError</tt><a class="headerlink" href="#core.pil.NotWritableTagError" title="Permalink to this definition">¶</a></dt> <dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl> <dl class="class"> <dt id="core.pil.Photo"> <em class="property"> class </em><tt class="descclassname">core.pil.</tt><tt class="descname">Photo</tt><big>(</big><em>info</em>, <em>info_to_dump=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo" title="Permalink to this definition">¶</a></dt> <dd><p>Use <a title="core.pil.get_photo" class="reference" href="#core.pil.get_photo"><tt class="xref docutils literal"><span class="pre">get_photo()</span></tt></a> to obtain a photo from a filename.</p> <dl class="method"> <dt id="core.pil.Photo.append_to_report"> <tt class="descname">append_to_report</tt><big>(</big><em>filename</em>, <em>image=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.append_to_report" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.apply_pil"> <tt class="descname">apply_pil</tt><big>(</big><em>function</em>, <em>*arg</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Photo.apply_pil" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.call"> <tt class="descname">call</tt><big>(</big><em>command</em>, <em>check_exe=True</em>, <em>shell=None</em>, <em>size=None</em>, <em>unlock=False</em>, <em>output_filename=None</em>, <em>mode=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.call" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.clear_log"> <tt class="descname">clear_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.clear_log" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.close"> <tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.close" title="Permalink to this definition">¶</a></dt> <dd>Remove circular references.</dd></dl> <dl class="method"> <dt id="core.pil.Photo.convert"> <tt class="descname">convert</tt><big>(</big><em>mode</em>, <em>*args</em>, <em>**keyw</em><big>)</big><a class="headerlink" href="#core.pil.Photo.convert" title="Permalink to this definition">¶</a></dt> <dd>Converts all layers to a different mode.</dd></dl> <dl class="method"> <dt id="core.pil.Photo.get_filename"> <tt class="descname">get_filename</tt><big>(</big><em>folder</em>, <em>filename</em>, <em>typ</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_filename" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.get_flattened_image"> <tt class="descname">get_flattened_image</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.get_flattened_image" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.get_layer"> <tt class="descname">get_layer</tt><big>(</big><em>name=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_layer" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.get_log"> <tt class="descname">get_log</tt><big>(</big><big>)</big><a class="headerlink" href="#core.pil.Photo.get_log" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.get_thumb"> <tt class="descname">get_thumb</tt><big>(</big><em>size=(128</em>, <em>128)</em><big>)</big><a class="headerlink" href="#core.pil.Photo.get_thumb" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.log"> <tt class="descname">log</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#core.pil.Photo.log" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.resize"> <tt class="descname">resize</tt><big>(</big><em>size</em>, <em>method</em><big>)</big><a class="headerlink" href="#core.pil.Photo.resize" title="Permalink to this definition">¶</a></dt> <dd>Resizes all layers to a different size</dd></dl> <dl class="method"> <dt id="core.pil.Photo.rotate_exif"> <tt class="descname">rotate_exif</tt><big>(</big><em>reverse=False</em><big>)</big><a class="headerlink" href="#core.pil.Photo.rotate_exif" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="core.pil.Photo.safe_mode"> <tt class="descname">safe_mode</tt><big>(</big><em>format</em><big>)</big><a class="headerlink" href="#core.pil.Photo.safe_mode" title="Permalink to this definition">¶</a></dt> <dd>Convert the photo into a safe mode for this specific format</dd></dl> <dl class="method"> <dt id="core.pil.Photo.save"> <tt class="descname">save</tt><big>(</big><em>filename</em>, <em>format=None</em>, <em>save_metadata=True</em>, <em>**options</em><big>)</big><a class="headerlink" href="#core.pil.Photo.save" title="Permalink to this definition">¶</a></dt> <dd>Saves a flattened image</dd></dl> <dl class="method"> <dt id="core.pil.Photo.set_layer"> <tt class="descname">set_layer</tt><big>(</big><em>layer</em>, <em>name=None</em><big>)</big><a class="headerlink" href="#core.pil.Photo.set_layer" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="function"> <dt id="core.pil.fix_EXIF"> <tt class="descclassname">core.pil.</tt><tt class="descname">fix_EXIF</tt><big>(</big><em>tag</em><big>)</big><a class="headerlink" href="#core.pil.fix_EXIF" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="function"> <dt id="core.pil.get_photo"> <tt class="descclassname">core.pil.</tt><tt class="descname">get_photo</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#core.pil.get_photo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="function"> <dt id="core.pil.image_to_dict"> <tt class="descclassname">core.pil.</tt><tt class="descname">image_to_dict</tt><big>(</big><em>filename</em>, <em>im=None</em><big>)</big><a class="headerlink" href="#core.pil.image_to_dict" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="function"> <dt id="core.pil.split_data"> <tt class="descclassname">core.pil.</tt><tt class="descname">split_data</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#core.pil.split_data" title="Permalink to this definition">¶</a></dt> <dd><p>Provide attribute access to the variables.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>d</em> (dict) – a dumped metadata dictionary</td> </tr> </tbody> </table> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="s">'date'</span><span class="p">:</span> <span class="s">'2008-11-27 13:54:33'</span><span class="p">,</span> <span class="s">'tuple'</span><span class="p">:</span> <span class="p">(</span><span class="mf">1</span><span class="p">,</span> <span class="mf">2</span><span class="p">)}</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="core.pil.split_vars_static_dynamic"> <tt class="descclassname">core.pil.</tt><tt class="descname">split_vars_static_dynamic</tt><big>(</big><em>vars</em><big>)</big><a class="headerlink" href="#core.pil.split_vars_static_dynamic" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="core.models.html" title="previous chapter">models</a></p> <h4>Next topic</h4> <p class="topless"><a href="core.preview.html" title="next chapter">preview</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" 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="core.preview.html" title="preview" >next</a> |</li> <li class="right" > <a href="core.models.html" title="models" >previous</a> |</li> <li><a href="index.html">Phatch v0.2 documentation</a> »</li> <li><a href="core.html" >core</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009, www.stani.be. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2. </div> </body> </html>