from scipy.misc.pilutil import imresize x = np.random.randn(3,3) imresize(x, 2) Traceback (most recent call last): File "/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py",
Is imresize defined twice in scipy.misc.pilutil.py or am i missing something? Thanks Vincent Below is a separate issue maybe related to the above. According to the docs size : int, float or tuple * int - Percentage of current size. * float - Fraction of current size. * tuple - Size of the output image. an integer should work. Just wonder if someone can confirm this line 1, in <module> # Used internally for debug sandbox under external interpreter File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/misc/pilutil.py", line 316, in imresize imnew = im.resize(size) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1302, in resize im = self.im.resize(size, resample) TypeError: must be 2-item sequence, not float
imresize(x, 2.0) array([[255, 255, 252, 252, 171, 171], [255, 255, 252, 252, 171, 171], [163, 163, 0, 0, 185, 185], [163, 163, 0, 0, 185, 185], [255, 255, 223, 223, 167, 167], [255, 255, 223, 223, 167, 167]], dtype=uint8) imresize(x, (5,4)) array([[255, 255, 252, 171], [255, 255, 252, 171], [163, 163, 0, 185], [163, 163, 0, 185], [255, 255, 223, 167]], dtype=uint8)