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
::  
:: initialize pandas dataframe with column names 
:: python find files recursive 
Python ::  
:: python clone object 
Python ::  
::  
Python :: python dns pip 
Python ::  
::  
::  
::  
::  
::  
Python ::  
:: how to open local html file in python 
Python ::  
Python :: standardize columns in pandas 
Python ::  
::  
Python :: .astype datetime 
::  
Python :: how to find if a value is even or odd in python 
Python :: plt.clear 
:: df select rows based on condition 
Python :: nltk stop words 
Python ::  
Python :: python pie chart with legend 
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
6+8 =