python plt resize image code example
Example 1: resize imshow opencv python
import cv2
cv2.namedWindow("output", cv2.WINDOW_NORMAL)
im = cv2.imread("earth.jpg")
imS = cv2.resize(im, (960, 540))
cv2.imshow("output", imS)
cv2.waitKey(0)
Example 2: python pillow resize image
from PIL import Image
basewidth = 300
img = Image.open('somepic.jpg')
wpercent = (basewidth/float(img.size[0]))
hsize = int((float(img.size[1])*float(wpercent)))
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
img.save('sompic.jpg')