Image data to Array, Python -> WxImage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lmbgm
Posts: 1
Joined: 2011-10-03T07:19:06-07:00
Authentication code: 8675308

Image data to Array, Python -> WxImage

Post 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?
Post Reply