wx.Image GetDataBuffer returns a memory object instead a data Buffer

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wx.Image GetDataBuffer returns a memory object instead a data Buffer

sebastian lópez
Hi

I want to get the data buffer from a wx.Image but I'm getting a memory object instead

>>> image
<wx._core.Image object at 0x196E1580>
>>> image.GetDataBuffer()
<memory at 0x199ED2B0>
>>> help(image.GetDataBuffer)
Help on built-in function GetDataBuffer:

GetDataBuffer(...)
    GetDataBuffer() -> PyObject
    
    Returns a writable Python buffer object that is pointing at the RGB
    image data buffer inside the :class:`Image`. You need to ensure that
    you do
    not use this buffer object after the image has been destroyed.


wx.__version__   '3.0.3.dev2891+36b8076'
python version  v2.7.13:a06454b1afa1

thanks in advance

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Image GetDataBuffer returns a memory object instead a data Buffer

Tim Roberts
sebastian lópez wrote:
>
> I want to get the data buffer from a wx.Image but I'm getting a memory
> object instead

Right, that IS the data buffer.  I'm not sure what you are expecting.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Image GetDataBuffer returns a memory object instead a data Buffer

Chris Barker - NOAA Federal


On Mon, Apr 24, 2017 at 10:17 AM, Tim Roberts <[hidden email]> wrote:
sebastian lópez wrote:
>
> I want to get the data buffer from a wx.Image but I'm getting a memory
> object instead

Right, that IS the data buffer.  I'm not sure what you are expecting.

indeed -- it is a "memoryview" object:


exactly what you should want.

-CHB

 

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Image GetDataBuffer returns a memory object instead a data Buffer

Robin Dunn


On Monday, April 24, 2017 at 11:33:34 AM UTC-7, Chris Barker wrote:


On Mon, Apr 24, 2017 at 10:17 AM, Tim Roberts <[hidden email]> wrote:
sebastian lópez wrote:
>
> I want to get the data buffer from a wx.Image but I'm getting a memory
> object instead

Right, that IS the data buffer.  I'm not sure what you are expecting.

indeed -- it is a "memoryview" object:

<a href="https://docs.python.org/3/c-api/memoryview.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F3%2Fc-api%2Fmemoryview.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG99betxlOhe73-P7qEBMy7ascCwA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F3%2Fc-api%2Fmemoryview.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG99betxlOhe73-P7qEBMy7ascCwA&#39;;return true;">https://docs.python.org/3/c-api/memoryview.html

exactly what you should want.


And the change is documented too: https://wxpython.org/Phoenix/docs/html/MigrationGuide.html#wx-image-and-python-buffer-objects
 

-- 
Robin Dunn
Software Craftsman
http://wxPython.org

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Image GetDataBuffer returns a memory object instead a data Buffer

sebastian lópez
You got it!

^_^


El miércoles, 26 de abril de 2017, 2:43:25 (UTC-5), Robin Dunn escribió:


On Monday, April 24, 2017 at 11:33:34 AM UTC-7, Chris Barker wrote:


On Mon, Apr 24, 2017 at 10:17 AM, Tim Roberts <<a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="ExgqgBI0AwAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...> wrote:
sebastian lópez wrote:
>
> I want to get the data buffer from a wx.Image but I'm getting a memory
> object instead

Right, that IS the data buffer.  I'm not sure what you are expecting.

indeed -- it is a "memoryview" object:

<a href="https://docs.python.org/3/c-api/memoryview.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F3%2Fc-api%2Fmemoryview.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG99betxlOhe73-P7qEBMy7ascCwA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F3%2Fc-api%2Fmemoryview.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG99betxlOhe73-P7qEBMy7ascCwA&#39;;return true;">https://docs.python.org/3/c-api/memoryview.html

exactly what you should want.


And the change is documented too: <a href="https://wxpython.org/Phoenix/docs/html/MigrationGuide.html#wx-image-and-python-buffer-objects" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FMigrationGuide.html%23wx-image-and-python-buffer-objects\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaEWdQi0d9OX0DH2QLI8dtB1_xFA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FMigrationGuide.html%23wx-image-and-python-buffer-objects\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaEWdQi0d9OX0DH2QLI8dtB1_xFA&#39;;return true;">https://wxpython.org/Phoenix/docs/html/MigrationGuide.html#wx-image-and-python-buffer-objects
 

-- 
Robin Dunn
Software Craftsman
<a href="http://wxPython.org" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2FwxPython.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHG9kM-NEpJfIvl_lWJvA23SuLjOA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2FwxPython.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHG9kM-NEpJfIvl_lWJvA23SuLjOA&#39;;return true;">http://wxPython.org

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...