Hi everyone,

a quick question. I am using the latest pyglet version from the repo under OSX 
10.8 with Python 3.

I need image data from pyglet - let's say as in screenshots - and I'm using the 
save function, as it is described here -> 
http://www.pyglet.org/doc/programming_guide/saving_an_image.html .

I need to furthermore work with the image data (display them in a web browser). 
It works if I right them to the disk and then read it from there - but it's 
slooow.

So I thought, I might just as well write the screenshot to a StringIO object, 
like this:

        img = pyglet.image.get_buffer_manager().get_color_buffer()
        file = io.StringIO()
        img.save('buffer.png', file)
        output = file.getvalue()
        file.close()

, to furthermore work with the .png image as the output variable in my python 
code.

However, it throws me:

  File 
"/Users/jonas/Desktop/micropsi2/micropsi_core/world/minecraft/vis/main.py", 
line 440, in advanceVisualisation
    img.save('buffer.png', file)
  File 
"/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyglet/image/__init__.py",
 line 445, in save
    encoder.encode(self, file, filename)
  File 
"/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyglet/image/codecs/pil.py",
 line 107, in encode
    raise ImageEncodeException(e)
pyglet.image.codecs.ImageEncodeException: string argument expected, got 'bytes'



… if anyone has an idea, for how I could do what I'm trying to achieve, I would 
be very grateful. :)

Regards,
Jonas

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to