Is imresize() defined twice in scipy.misc.pilutil.py
![](https://secure.gravatar.com/avatar/226e40fdc55d4597a46279296a616384.jpg?s=120&d=mm&r=g)
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)
![](https://secure.gravatar.com/avatar/b0f62d137f9ea1d0b6cc4e7e6f61b119.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/da3a0a1942fbdc5ee9a9b8115ac5dae7.jpg?s=120&d=mm&r=g)
Mon, 28 Jun 2010 19:51:51 -0500, Warren Weckesser wrote:
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?
I guess something like that would be hard to remember :) The two functions appear to have slightly different functionality. Nevertheless, perhaps it's just best to remove the first one (which is overridden by the second one). This looks pretty much like legacy stuff. -- Pauli Virtanen
![](https://secure.gravatar.com/avatar/226e40fdc55d4597a46279296a616384.jpg?s=120&d=mm&r=g)
Posted a ticket for this. Ticket #1221 (new defect) http://projects.scipy.org/scipy/ticket/1221 Vincent On Tue, Jun 29, 2010 at 2:59 AM, Pauli Virtanen <pav@iki.fi> wrote:
Mon, 28 Jun 2010 19:51:51 -0500, Warren Weckesser wrote:
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?
I guess something like that would be hard to remember :)
The two functions appear to have slightly different functionality. Nevertheless, perhaps it's just best to remove the first one (which is overridden by the second one). This looks pretty much like legacy stuff.
-- Pauli Virtanen
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
![](https://secure.gravatar.com/avatar/226e40fdc55d4597a46279296a616384.jpg?s=120&d=mm&r=g)
On Sat, Jul 3, 2010 at 11:26 AM, Vincent Davis <vincent@vincentdavis.net> wrote:
Posted a ticket for this. Ticket #1221 (new defect) http://projects.scipy.org/scipy/ticket/1221
Vincent
On Tue, Jun 29, 2010 at 2:59 AM, Pauli Virtanen <pav@iki.fi> wrote:
Mon, 28 Jun 2010 19:51:51 -0500, Warren Weckesser wrote:
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?
I guess something like that would be hard to remember :)
The two functions appear to have slightly different functionality. Nevertheless, perhaps it's just best to remove the first one (which is overridden by the second one). This looks pretty much like legacy stuff.
-- Pauli Virtanen
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
I had assumed nothing had been done on this, I guess I was wrong. Josef noticed that this had been fixed. So this ticket can be closed. http://projects.scipy.org/scipy/ticket/1221 Vincent
participants (3)
-
Pauli Virtanen
-
Vincent Davis
-
Warren Weckesser