Ivygggg
Ivygggg

Reputation: 19

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()

Upvotes: 0

Views: 3222

Answers (1)

Mariusz Jamro
Mariusz Jamro

Reputation: 31683

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")

Upvotes: 2

Related Questions