I've added image support in CVS along the lines discussed last week.
Currently only array loading (floats) is supported with
imshow(X)
If X is MxN, assume luminance (grayscale)
If X is MxNx3, assume RGB
If X is MxNx4, assume RGBA
but I'll work on adding PNG and colormaps in the
not-too-distant-future, as well as supporting more pixel formats. You
must use one of the *Agg backends. I'll add some helper methods to
make the scaled image data accessible by GTK and WX in the near
future.
See examples/image_demo.py.
It would also be nice to have a "frompil" method that could load the
image from a pil instance to get all the pil loaders for free. I
don't know how hard this would be.
You can set the interpolation method and whether or not aspect ratio
is preserved with
im = imshow(A)
im.set_aspect('preserve') # free is default; not constrained
im.set_interpolation('bicubic') # bilinear default; see image module for others
You can also set the data extent of the image if you want to plot
lines, etc over your image. See examples/image_demo2.py. Currently
data extent with aspect ratio preserved is broken.
After playing around with some examples, there are a few things that
have become higher priorities.
* update navigation controls. The asymmetric x and y zooms don't
make a lot of sense for images. I plan to write a new toolbar with
symmetric zooms, "hand" pan, and zoom to rectangle as discussed
before. I'll try and write this in a way that the various GUI
backends can subclass without too much additional work,
* figure resize - on GTK and Tk at least, the ability to resize the
figure is too limited. TkAgg, for example, always preserves the
figure aspect ratio and GTK won't let you get smaller than the
initial dimensions. It would be nice to allow more freedom here.
Let me know how it goes... Here's a snapshot or the sdist:
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.52c.tar.gz
JDH