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 :: remove extra spaces python 
Python :: qlistwidget item clicked event pyqt 
Python :: get the name of a file using os 
Python :: how to resize windows in python 
Python :: how to open an image in opencv 
Python :: how to delete role discord py rewrite 
Python :: create and use python classes 
Python :: create dict from two columns pandas 
Python :: object literal python 
Python :: python class variables make blobal 
Python :: pandas change to first day 
Python :: endswith python 
Python :: python zeros to nan 
Python :: python numpy vstack 
Python :: dataframe to list pyspark 
Python :: append item to array python 
Python :: python - remove columns with same name and keep first 
Python :: pandas count unique values in column 
Python :: python check for duplicate 
Python :: square all elements in list python 
Python :: convert list into integer in python 
Python :: pandas strip whitespace 
Python :: Write a Python program to get the Python version you are using. 
Python :: dropna in specific column pandas 
Python :: how to pass data between views django 
Python :: PYTHON 3.0 MAKE A HEART 
Python :: create limit using matplotlib 
Python :: error handling flask 
Python :: random numbers python 
Python :: plot background color matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =