Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pil get image size

from PIL import Image

im = Image.open('whatever.png')
width, height = im.size
Comment

width and height of pil image

image = PIL.Image.open("sample.png")
width, height = image.size
Comment

Pillow (PIL): Get image size (width, height) with size, width, height

from PIL import Image

im = Image.open('data/src/lena.jpg')

print(im.size)
print(type(im.size))
# (400, 225)
# <class 'tuple'>

w, h = im.size
print('width: ', w)
print('height:', h)
# width:  400
# height: 225
Comment

PREVIOUS NEXT
Code Example
Python :: how to change font in tkinter 
Python :: python difflib compare two strings 
Python :: sklearn cross_val_score scoring metric 
Python :: get first row sqlalchemy 
Python :: get guild by id discord.py 
Python :: python program to draw square 
Python :: open and read a file in python 
Python :: integer colomn to datetime pandas python 
Python :: python numphy how to use fractions 
Python :: how to create a label in python 
Python :: npr python 
Python :: list comprehension if else 
Python :: create new dataframe with columns from another dataframe pandas 
Python :: anaconda snake 
Python :: The Python path in your debug configuration is invalid. 
Python :: django m2m .add 
Python :: change color of butto in thkinter 
Python :: how to get how many rows is in a dataframe? 
Python :: python mahalanobis distance 
Python :: permutations of a set 
Python :: plt.legend( 
Python :: count decimal number python 
Python :: rnadom number python 
Python :: set seed train test split 
Python :: python convert string to lowercase 
Python :: python check if 3 values are equal 
Python :: python count empty lines in text file 
Python :: colorbar min max matplotlib 
Python :: python http.server 
Python :: jinja macro import 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =