Page 1 of 1

Image data to Array, Python -> WxImage

Posted: 2011-10-03T07:47:08-07:00
by lmbgm
This is related to Python, but if someone can give me the C equiv way (using MagicCore) of doing it, that would be fine too.
I am trying to use PythonMagick (which has zero documenation) to convert an Image to a WxImage.

I found this site: http://wiki.wxpython.org/WorkingWithIma ... Library.29
It gives the following example:

Code: Select all

    def convertMGtoWX(self, magickimage):
        img = PythonMagick.Image(magickimage)  # make copy
        img.depth = 8        #  change depth only for display
        img.magick = "RGB"
        data = img.data
        wximg = wx.wxEmptyImage(img.columns(), img.rows())
        wximg.SetData(data)
        return wximg
I get the following Error: "AttributeError: 'Image' object has no attribute 'data'"

This seems to be correct, when I look at the Image class, I see no "data".

How can I get the raw data of the image in an array?