Answers for "python pil resize image"


python pil resize image

from PIL import Image

# can also open other image types
img ="some_random_image.jpg")
# WIDTH and HEIGHT are integers
resized_img = img.resize((WIDTH, HEIGHT))"resized_image.jpg")
Posted by: Guest on April-05-2020

python pillow resize image

from PIL import Image
# set the base width of the result
basewidth = 300
img ='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)'sompic.jpg')
Posted by: Guest on May-23-2020

change image resolution pillow

size = 7016, 4961
im ="my_image.png")
im_resized = im.resize(size, Image.ANTIALIAS)"my_image_resized.png", "PNG")
Posted by: Guest on July-22-2020

pil resize image

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

Python Answers by Framework

Browse Popular Code Answers by Language