On Sun, May 25, 2008 at 5:19 AM, Gregor Thalhammer <[EMAIL PROTECTED]> wrote:
> matplotlib is _not_ a dedicated image manipulation package, so please > don't blame it that you don't manage to easily use it as such one. > However, matplotlib indeed offers high quality image scaling abilities > (at the moment not for downscaling) due to the use of Agg. While mpl it is not a general purporse image library as you say, it would be nice if we exposed a minimal set of image functionality so users could take advantage of agg's nice rescaling. Easy stuff should be easy.... I did add support for PIL loading in imread, so if you have it you will use it. Thus in svn you can do, if PIL is installed, X = imread('somefile.jpg') # or any other format supported by PIL This will help reduce the boilerplate. I would like to expose at least a resize and rotation from agg, with a choice of interpolation schemes, exposed at the array level and not just the display level. I think agg2.4 also added some new interpolation schemes designed to support down-sampling which is useful for large mega-pixel images, and these haven't been exposed since I wrote the original interpolation options against agg2.3. In testing this stuff, I found a bug bug in image handling on the trunk -- if you zoom to part of an image with zoom-to-rect, the part that you get zoomed to is not the part you select. This is most apparent if you load an image with easily recognizable features, eg a picture of a person. This problem is on the trunk but not the branch -- here is some example code: In [8]: fig = plt.figure() In [9]: ax = fig.add_subplot(111) In [10]: ax.set_aspect('auto') In [11]: X = imread('/Users/jdhunter/Desktop/IMG_0907.JPG') In [12]: ax.imshow(X, origin='lower', aspect='auto') Out[12]: <matplotlib.image.AxesImage object at 0x112586b0> In [13]: ax.figure.canvas.draw() In [14]: ax.cla() In [15]: ax.set_aspect('auto') In [16]: ax.imshow(X, origin='upper', aspect='auto') Out[16]: <matplotlib.image.AxesImage object at 0x11258690> In [17]: fig.canvas.draw() ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users