[SciPy-user] misc.imresize

Carlos Medrano ctmedra at unizar.es
Mon Apr 16 13:04:28 EDT 2007


Hi:

 I have been working with imresize and I think that there is a problem when 
the size is a real number. It only accepts float but not float32 or float64 
(if not exactly float it thinks it can be a tuple). It is not critical but it 
should probably accept all these types. It is nice to work directly with 
ndarray instead of PIL images.

 I think that the PIL method imresize accepts only a tuple.

Python: 2.4.3, scipy and numpy from Andrew Straw repository
Scipy: '0.5.2.dev2299'
Numpy: '1.0'
PIL: 1.1.5-4ubuntu1
---------------------------------------------------------------
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import *
>>> im=lena()
>>> im.shape
(512, 512)
>>> im1=misc.imresize(im,1.1)
/usr/lib/python2.4/site-packages/PIL/Image.py:1200: DeprecationWarning: 
integer argument expected, got float
  im = self.im.resize(size, resample)
>>> im1.shape
(563, 563)
>>> im1=misc.imresize(im,float(1.1))
>>> im1=misc.imresize(im,float32(1.1))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/scipy/misc/pilutil.py", line 256, in 
imresize
    size = (size[1],size[0])
TypeError: unsubscriptable object
>>> im1=misc.imresize(im,float64(1.1))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/scipy/misc/pilutil.py", line 256, in 
imresize
    size = (size[1],size[0])
TypeError: unsubscriptable object

Regards: 

Carlos Medrano



More information about the SciPy-User mailing list