9951 explained code solutions for 126 technologies


python-pillowHow to create thumbnail


from PIL import Image, ImageDraw, ImageFont

im = Image.open('/var/www/examples/heroine.png')
im.thumbnail((100, 100))

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

.thumbnail(

creates image thumbnail that fits into given width/height

100, 100

thumbnail width and height

.show()

displays resulting image