Resize images using Python PIL Pillow
The following script will resize the image to half of its width and half of its height:
examples/python/resize_image.py
from PIL import Image in_file = 'images/code-maven-workshops-1600x900.png' # 1600, 900 out_file = 'new.png' img = Image.open(in_file) size = (img.size[0]/2, img.size[1]/2) img.thumbnail(size) img.save(out_file)
Published on 2019-04-22
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post