title: Passing a SWIG proxy object as input to PIL.Image.frombuffer
body: <p>I'm using the SWIG <code>array_class</code> macro defined in carrays.i to create an unsigned char buffer which can be sent to the c++-side of my project, which handles picture taking. This works fine – the buffer is filled width data after the camera has triggered, and I can dereference the buffer using [] from python to see what it holds. I now want to create a PIL image from that buffer, using <code>Image.frombuffer</code>:</p>
  
  <pre><code>Image.frombuffer(mode, size, data) =&gt; image
  </code></pre>
  
  <p>(New in PIL 1.1.4). Creates an image memory from pixel data in a string or buffer object, using the standard "raw" decoder.</p>
  
  <p>but I get an error message telling me that the SWIG object I supply is not a python buffer:</p>
  
  <blockquote>
    <p>File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1853, in frombuffer<br>
    core.map_buffer(data, size, decoder_name, None, 0, args)<br>
    TypeError: expected string or buffer  </p>
  </blockquote>
  
  <p>How can I make this proxy of a SWIG Object compatible with the type of buffer that <code>Image.frombuffer</code> expects?</p>