Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pil resize image

from PIL import Image

# Image.open() can also open other image types
img = Image.open("some_random_image.jpg")
# WIDTH and HEIGHT are integers
resized_img = img.resize((WIDTH, HEIGHT))
resized_img.save("resized_image.jpg")
Comment

change image resolution pillow

size = 7016, 4961
im = Image.open("my_image.png")
im_resized = im.resize(size, Image.ANTIALIAS)
im_resized.save("my_image_resized.png", "PNG")
Comment

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') 
Comment

pil resize image

im = Image.open('image.jpg')  
im = im.resize((w, h)) 
Comment

PREVIOUS NEXT
Code Example
Python :: combine two dictionary adding values for common keys 
Python :: sample data frame in python 
Python :: flask get value of radio button 
Python :: check if anything in a list is in a string python 
Python :: opencv export image 
Python :: how to use timeit in python 3 
Python :: video streaming flask 
Python :: python sizeof 
Python :: pandas sort by date descending 
Python :: python tabulate float format 
Python :: Renaming an index in pandas data frame 
Python :: get pixel color pygame 
Python :: iterate through attributes of class python 
Python :: how to define a constant in python 
Python :: check if string is empty python 
Python :: python remove empty list 
Python :: how to count the number of files in a directory using python 
Python :: get index of highest value in array python 
Python :: flask return error response 
Python :: how to reboot a python script 
Python :: pandas apply function on two columns 
Python :: filter function in pandas stack overflow 
Python :: are tuples mutable 
Python :: isistance exmaple 
Python :: changing the current working directory in python 
Python :: get a slice of string in python 
Python :: how to save a pickle file 
Python :: pd df drop columns 
Python :: how to create a tuple from csv python 
Python :: change color of butto in thkinter 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =