Resize images with PIL

How to resize images with PIL. As I used it for the last post, I want to show you how to use the resize function in PIL, Python Imaging Lybrary, in an practical example, that is always the best method to learn and memorize things. There is just one simple line of code (or maybe two).

from PIL import Image

img = Image.open("myimage.png")
img = img.resize((128, 128), Image.ANTIALIAS)
img.save("myimage_little.png")


Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.