SciPy

scipy.misc.imresize

scipy.misc.imresize(*args, **kwds)

imresize is deprecated! imresize is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use skimage.transform.resize instead.

Resize an image.

This function is only available if Python Imaging Library (PIL) is installed.

Warning

This function uses bytescale under the hood to rescale images to use the full (0, 255) range if mode is one of None, 'L', 'P', 'l'. It will also cast data for 2-D images to uint32 for mode=None (which is the default).

Parameters:
arr : ndarray

The array of image to be resized.

size : int, float or tuple
  • int - Percentage of current size.
  • float - Fraction of current size.
  • tuple - Size of the output image (height, width).
interp : str, optional

Interpolation to use for re-sizing (‘nearest’, ‘lanczos’, ‘bilinear’, ‘bicubic’ or ‘cubic’).

mode : str, optional

The PIL image mode (‘P’, ‘L’, etc.) to convert arr before resizing. If mode=None (the default), 2-D images will be treated like mode='L', i.e. casting to long integer. For 3-D and 4-D arrays, mode will be set to 'RGB' and 'RGBA' respectively.

Returns:
imresize : ndarray

The resized array of image.

See also

toimage
Implicitly used to convert arr according to mode.
scipy.ndimage.zoom
More generic implementation that does not use PIL.

Previous topic

scipy.misc.imread

Next topic

scipy.misc.imrotate