PythonMagick: Convert image to gray scale (black & white)

Osmo Maatta <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <[email protected]>
Hello,
I want to use PythonMagick to convert an image to gray scale.  I've read 
the documentation of Magick++ on http://www.imagemagick.org/Magick++ but 
cannot figure out how to access the GrayscaleType or GRAYColorspace 
attributes from Python.  Please help.

Sample code:

import PythonMagick

filename = "test1.png"
img = PythonMagick.Image()
img.read(filename)

img.type = GrayscaleType

#img.quantizeColorSpace(??)
#img.quantize()
#img.channel(PythonMagick.ChannelType.RedChannel ??)

img.write("test2.png")
----

This system is: 64bit Ubuntu 9.10.

$ apt-cache show python-pythonmagick
python-pythonmagick - Object-oriented Python interface to ImageMagick
Version: 0.9.1-1ubuntu1
----

What is the best and most up2date Python binding to ImageMagick?
<http://www.procoders.net/?p=67#comments>----
ps. I know about PIL but want to use ImageMagick instead.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.