[SciPy-Dev] Is imresize() defined twice in scipy.misc.pilutil.py
Warren Weckesser
warren.weckesser@enthought....
Mon Jun 28 19:51:51 CDT 2010
Vincent Davis wrote:
> Is imresize defined twice in scipy.misc.pilutil.py or am i missing something?
>
Yup, and they were both added by travo about eight years ago (r521 and
r545). Hey Travis, what's up with that?
Warren
> 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
>
>
>>>> 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",
> 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)
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
More information about the SciPy-Dev
mailing list