title: kivy: possible to use buffer as image source?
body: <p>I've got code along the lines of the following which generates a new image out of some existing images.</p>
  
  <pre><code>from PIL import Image as pyImage
  
  def create_compound_image(back_image_path, fore_image_path, fore_x_position):
  
      back_image_size = get_image_size(back_image_path)
      fore_image_size = get_image_size(fore_image_path)
  
      new_image_width = (fore_image_size[0] / 2) + back_image_size[0]
      new_image_height = fore_image_size[1] + back_image_size[1]
  
      new_image = create_new_image_canvas(new_image_width, new_image_height)
  
      back_image = pyImage.open(back_image_path)
      fore_image = pyImage.open(fore_image_path)
  
      new_image.paste(back_image, (0, 0), mask = None) 
      new_image.paste(fore_image, (fore_x_position, back_image_size[1]), mask = None)
  
      return new_image
  </code></pre>
  
  <p>Later in the code, I've got something like this: </p>
  
  <pre><code>from kivy.uix.image import Image
  img = Image(source = create_compound_image(...))
  </code></pre>
  
  <p>If I do the above, I get the message that <code>Image.source only accepts string/unicode</code>.</p>
  
  <p>If I create a <code>StringIO.StringIO()</code> object from the new image, and try to use that as the source, the error message is the same as above. If I use the output of the StringIO object's getvalue() method as the source, the message is that the <code>source must be encoded string without NULL bytes, not str</code>.</p>
  
  <p>What is the proper way to use the output of the <code>create_compound_image()</code> function as the source when creating a kivy Image object?</p>