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 read from a file into a list in python 
Python :: code for showing contents of a file and printing it in python 
Python :: python copy file and rename 
Python :: delete image with python 
Python :: brownie from wei to ether 
Python :: E: Unable to locate package python3-pip 
Python :: python convert current datetime to rfc 1123 format 
Python :: pandas dataframe from dict 
Python :: python pil invert image color 
Python :: matplotlib remove ticks and lines 
Python :: how to update python in linux 
Python :: filter list with python 
Python :: csv to numpy array 
Python :: python print in color 
Python :: np array to df 
Python :: pandas standard deviation on column 
Python :: pandas dataframe convert nan to string 
Python :: python install libs 
Python :: how to make a discord bot delete messages python 
Python :: get active window title python 
Python :: opencv python convert rgb to hsv 
Python :: get current month python 
Python :: traceback python 
Python :: how to plot a graph using matplotlib 
Python :: 1 eth to wei 
Python :: how to edit a specific line in text file in python 
Python :: python get current mouse position 
Python :: min max and avg function of python 
Python :: load from np file py 
Python :: python is letter or number functin 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =