pyufunc.img_resize#

pyufunc.img_resize(img, width=None, height=None, inter=None, verbose=True)#

Resize image.

Parameters:
  • img (Union[np.ndarray, str, Image.Image]) – image array or image path or PIL image object

  • width (int, optional) – target width, default is None, unit: pixel

  • height (int, optional) – target height, default is None, unit: pixel

  • inter (int, optional) – interpolation method, default is cv2.INTER_AREA

  • verbose (bool, optional) – print out processing message, default is True

Returns:

the resized image

Return type:

np.ndarray

Example

>>> import cv2
>>> from pyufunc import img_resize
>>> img = cv2.imread('test.jpg')
>>> img_r = img_resize(img, width=100, height=100)
>>> cv2.imshow('resized image', img_r)
>>> cv2.waitKey(0)
>>> cv2.destroyAllWindows()