title: Create a file object from raw binary information in Python
body: <h3>Question</h3>
  <p>What is a clean way to create a file object from raw binary information in Python?</p>
  <h3>More Info</h3>
  <p>The reason I need to do this is because I have the raw binary information comprising a jpeg image stored in ram. I need to put it inside some kind of file object so that I can resize the image using Python's <a href="http://pillow.readthedocs.org/en/latest/about.html" rel="nofollow noreferrer">Pillow</a> library.</p>
  <p>According to the <a href="http://pillow.readthedocs.org/en/latest/reference/Image.html" rel="nofollow noreferrer">pillow documentation</a>, the file object needs to implement the <code>read()</code>, <code>seek()</code>, and <code>tell()</code> methods.</p>
  <pre>
  The file object must implement read(), seek(), and tell() methods, and be opened in binary mode.
  </pre>