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

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 :: extract numbers from string python 
Python :: get all the keys in a dictionary python 
Python :: python create map with coordinates 
Python :: spacy stopwords 
Python :: pip install apache beam gcp 
Python :: python radians to degrees 
Python :: OSError: cannot write mode RGBA as JPEG Python 
Python :: how to pause code for some time in python 
Python :: draw heart with python 
Python :: import matplotlib.pyplot as plt 
Python :: tesseract.exe python 
Python :: How do I mock an uploaded file in django? 
Python :: pyqt5 change button color 
Python :: how to play music on pygame 
Python :: exclude columns pandas 
Python :: reload all extensions discord.py 
Python :: proxy selenium python 
Python :: python setup.py bdist_wheel did not run successfully 
Python :: version of scikit learn 
Python :: add authorization header in python requests 
Python :: get video duration opencv python 
Python :: get list of all files in folder and subfolders python 
Python :: python get int from string 
Python :: import decisiontreeclassifier 
Python :: Python sort dataframe by list 
Python :: convert dictionary keys to int python 
Python :: find index of null values pandas 
Python :: list all files of a directory in Python 
Python :: python create n*n matrix 
Python :: how to know python bit version 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =