Hands-On Image Processing with Python
上QQ阅读APP看书,第一时间看更新

Creating a thumbnail

We can create a thumbnail from an image with the thumbnail() function, as shown in the following:

im_thumbnail = im.copy() # need to copy the original image first
im_thumbnail.thumbnail((100,100))
# now paste the thumbnail on the image
im.paste(im_thumbnail, (10,10)) im.save("../images/parrot_thumb.jpg") im.show()

The figure shows the output image generated by running the preceding code snippet: