PythonMagick-0.9.10 is incomplete, pyste is unmaintained

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
exzombie
Posts: 1
Joined: 2014-08-05T04:38:14-07:00
Authentication code: 6789

PythonMagick-0.9.10 is incomplete, pyste is unmaintained

Post by exzombie »

Hello!

I was very happy to find the PythonMagick bindings, which actually allow me to reliably load 16-bit images. Yay! Thanks guys!

The bindings are, however, incomplete, which I'm sure you know, given that the last patch was about adding the MagickCore::ColorspaceType enum. There are other enums missing, making several exposed functions useless. One example: missing MagickCore::ImageType enum makes using Image::type() to make a grayscale image quite hard :) (quantizeColorSpace() doesn't work). What is also missing is the Image.data attribute documented here. Combined with str/bytes inconsistencies in the Blob class, they make accessing raw pixel data quite hard. I spent two days trying to find a reliable way to move data into a numpy array, and the best I could get was

Code: Select all

    image = PythonMagick.Image(filename)
    blob = PythonMagick.Blob() 
    image.write(blob, 'RGB', 16)                                                               
    rawdata = b64decode(blob.base64())                                                         
    img = np.ndarray((image.rows(), image.columns(), 3),                                       
                           dtype='uint16', buffer=rawdata) 
and back again with

Code: Select all

    cmap = 'RGB'
    blob = PythonMagick.Blob()                                                                                             
    blob.base64(b64encode(bytes(array)).decode('ascii'))                                      
    image = PythonMagick.Image(blob, PythonMagick.Geometry(width, height), 16, cmap)
I wanted to fix these deficiencies, especially when I saw how simple it was to write pyste wrappers, but found that it was difficult to obtain pyste. Neither gentoo nor arch provide it anymore, and boost docs say that it is unmaintained. Have you considered using a different code generator? Boost docs suggest pyplusplus.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PythonMagick-0.9.10 is incomplete, pyste is unmaintained

Post by magick »

The ImageMagick team lacks indepth knowledge about Python development. If you have it, post a link to any patches you recommend here and we'll export a new release of PythonMagick.
Post Reply