Answers for "resize image using pil python"

3

python pillow resize image

from PIL import Image
# set the base width of the result
basewidth = 300
img = Image.open('somepic.jpg')
# determining the height ratio
wpercent = (basewidth/float(img.size[0]))
hsize = int((float(img.size[1])*float(wpercent)))
# resize image and save
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
img.save('sompic.jpg')
Posted by: Guest on May-23-2020
2

pil resize image

im = Image.open('image.jpg')  
im = im.resize((w, h))
Posted by: Guest on October-17-2020
0

pyhton image resize

from PIL import Image

from resizeimage import resizeimage

with open('test-image.jpeg', 'r+b')
    with Image.open() as image:
        is_valid = resizeimage.resize_cover.validate(image, [200, 100])

# do something else...

if is_valid:
    with Image.open('test-image.jpeg') as image:
        resizeimage.resize_cover.validate(image, [200, 100], validate=False)
        cover = resizeimage.resize_cover(image, [200, 100])
        cover.save('test-image-cover.jpeg', image.format)
Posted by: Guest on August-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language