Simplest way to resize an image-like array

John Ladasky ladasky at my-deja.com
Fri Sep 30 12:40:46 EDT 2011


Hi folks,

I have 500 x 500 arrays of floats, representing 2D "grayscale" images,
that I need to resample at a lower spatial resolution, say, 120 x 120
(details to follow, if you feel they are relevant).

I've got the numpy, and scipy, and matplotlib. All of these packages
hint at the fact that they have the capability to resample an image-
like array.  But after reading the documentation for all of these
packages, none of them make it straightforward, which surprises me.
For example, there are several spline and interpolation methods in
scipy.interpolate.  They seem to return interpolator classes rather
than arrays.  Is there no simple method which then calls the
interpolator, and builds the resampled array?

Yes, I can do this myself if I must -- but over the years, I've come
to learn that a lot of the code I want is already written, and that
sometimes I just have to know where to look for it.

Thanks!



More information about the Python-list mailing list