<!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.ImageFileIO — Pillow (PIL fork) 2.2.0 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.2.0', 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="top" title="Pillow (PIL fork) 2.2.0 documentation" href="../../index.html" /> <link rel="up" title="Module code" href="../index.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><a href="../../index.html">Pillow (PIL fork) 2.2.0 documentation</a> »</li> <li><a href="../index.html" accesskey="U">Module code</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <h1>Source code for PIL.ImageFileIO</h1><div class="highlight"><pre> <span class="c">#</span> <span class="c"># The Python Imaging Library.</span> <span class="c"># $Id$</span> <span class="c">#</span> <span class="c"># kludge to get basic ImageFileIO functionality</span> <span class="c">#</span> <span class="c"># History:</span> <span class="c"># 1998-08-06 fl Recreated</span> <span class="c">#</span> <span class="c"># Copyright (c) Secret Labs AB 1998-2002.</span> <span class="c">#</span> <span class="c"># See the README file for information on usage and redistribution.</span> <span class="c">#</span> <span class="sd">"""</span> <span class="sd">The **ImageFileIO** module can be used to read an image from a</span> <span class="sd">socket, or any other stream device.</span> <span class="sd">Deprecated. New code should use the :class:`PIL.ImageFile.Parser`</span> <span class="sd">class in the :mod:`PIL.ImageFile` module instead.</span> <span class="sd">.. seealso:: modules :class:`PIL.ImageFile.Parser`</span> <span class="sd">"""</span> <span class="kn">from</span> <span class="nn">io</span> <span class="kn">import</span> <span class="n">BytesIO</span> <div class="viewcode-block" id="ImageFileIO"><a class="viewcode-back" href="../../PIL.html#PIL.ImageFileIO.ImageFileIO">[docs]</a><span class="k">class</span> <span class="nc">ImageFileIO</span><span class="p">(</span><span class="n">BytesIO</span><span class="p">):</span> <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fp</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Adds buffering to a stream file object, in order to</span> <span class="sd"> provide **seek** and **tell** methods required</span> <span class="sd"> by the :func:`PIL.Image.Image.open` method. The stream object must</span> <span class="sd"> implement **read** and **close** methods.</span> <span class="sd"> :param fp: Stream file handle.</span> <span class="sd"> .. seealso:: modules :func:`PIL.Image.open`</span> <span class="sd"> """</span> <span class="n">data</span> <span class="o">=</span> <span class="n">fp</span><span class="o">.</span><span class="n">read</span><span class="p">()</span> <span class="n">BytesIO</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span></div> </pre></div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <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><a href="../../index.html">Pillow (PIL fork) 2.2.0 documentation</a> »</li> <li><a href="../index.html" >Module code</a> »</li> </ul> </div> <div class="footer"> © Copyright 1997-2011 by Secret Labs AB, 1995-2011 by Fredrik Lundh, 2010-2013 Alex Clark. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>