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

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 :: django queryset to list 
Python :: merge two query sets django 
Python :: queryset to list python 
Python :: check palindrome in python 
Python :: py -m pip 
Python :: float to int in python 
Python :: python pandas series to title case 
Python :: plot cumulative distribution function (cdf) in seaborn 
Python :: Set symmetric Using Python Set symmetric_difference() Method 
Python :: pandas read excel certain columns 
Python :: tkinter toplevel 
Python :: python get 2d array output as matrix 
Python :: geopandas geometry length 
Python :: escape sequence in python 
Python :: Python Frozenset operations 
Python :: python generate set of random numbers 
Python :: apply on dataframe access multiple columns 
Python :: how to install python in ubuntu 
Python :: fakultät python 
Python :: maximum element in dataframe row 
Python :: Python Making a New Directory 
Python :: layer enable time arcpy 
Python :: how to get the index of the first integer in a string python 
Python :: mapping with geopandas 
Python :: animations on canvas tkinter 
Python :: get html input in django 
Python :: Python message popup 
Python :: Rectangle with python 
Python :: yield python 
Python :: python line break inside string 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =