简体   繁体   中英

How to scale up picture in Python?

I am really do not know how to scale up a part of picture. I need scale up someone's nose.

Example:

def scaleUp():
    pic=makePicture(pickAFile())
    width=getWidth()
    height=getHeight()

You can use Pillow library to do that:

import Image

infile = "test.png"
outfile = "test_resized.jpg"
size = (1024, 768)

im = Image.open(infile)
print im.size   # Size in pixels

# Resize:
im.resize(size, Image.ANTIALIAS)
im.save(outfile, "JPEG")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM